--- layout : 'default' css : '' title : 'Dimmer' description : "Dimmers hide distractions to focus user's attention on particular content" type : 'UI Module' ---

You're all signed up for the weekly dog tips newsletter!
Your first edition will be sent on January 22

<%- @partial('header') %>

Usage

Dimming a section

Any element can be dimmed using a dimmer.

If a dimmer does not exist inside the element it will be created on first use.
$('.segment:first') .dimmer('toggle') ;

Showing a specific dimmer

If a dimmer is already included on the page, instead of calling dimmer on the section you would like to dim, you can can invoke behaviors directly on the dimmer.

// If a dimmer exists on a page, you can make it appear by calling it directly $('.page.dimmer:first') .dimmer('toggle') ;

Types

Content Dimmer

A dimmer can display content

Content must be included inside .content .center to display centered correctly in the modal.

Dog Photos

Your poodle photo uploaded successfully!

Your poodle photo uploaded successfully!

Page Dimmer

A dimmer can be formatted to be fixed to the page

Hello
Show

States

Active

An active dimmer will dim its parent container

Disabled

A disabled dimmer cannot be activated

Variations

Dimmer

Simple Dimmer

A dimmer can be controlled without javascript

Having any parent element receive the class ui dimmable dimmed will trigger the dimmer to display.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.

Inverted Dimmer

A dimmer can be formatted to have its colors inverted

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.

Behavior

All the following behaviors can be called using the syntax $('.foo').dimmer('behavior name', argumentOne, argumentTwo)

add content (element) Detatches a given element from DOM and reattaches element inside dimmer
show Shows dimmer
hide Hides dimmer
toggle Toggles current dimmer visibility
get duration Returns current duration for show or hide event depending on current visibility
get dimmer Returbns DOM element for dimmer
has dimmer Returns whether current dimmable has a dimmer
is dimmer Whether current element is a dimmer
is dimamable Whether current element is a dimmable section
is active Whether section's dimmer is active
is animating Whether dimmer is animating
is page Whether dimmable section is body
is enabled Whether dimmer is not disabled
is disabled Whether dimmer is disabled
is page dimmer Whether dimmer is a page dimmer
set active Sets page dimmer to active
set dimmable Sets an element as a dimmable section
set dimmed Sets a dimmable section as dimmed
set page dimmer Sets current dimmer as a page dimmer
set disabled Sets a dimmer as disabled

Display

You can display a dimmer by either invoking dimmer show on a section or a dimmer itself. If you choose to dim a dimmable section, a dimmer will automatically be created.

// these two are the same $('.ui.dimmable) .dimmer('show') ; $('.ui.dimmable .dimmer') .dimmer('show') ; // these two as well $('.ui.dimmable) .dimmer('hide') ; $('.ui.dimmable dimmer') .dimmer('hide') ;

Settings

Dimmer Settings
closable true Whether clicking on the dimmer should close it automatically
duration
duration : { show : 500, hide : 500 }
Animation duration of dimming. If an integer is used, that value will apply to both show and hide animations.
Callbacks
onInit None Callback after a dimmer html is generated.
onShow None Callback after a dimmer section is shown.
onHide None Callback after a dimmer section is hidden.
UI Module Settings
Name Dimmer Name used in debug logs
debug True Provides standard debug output to console
performance False Provides standard debug output to console
verbose False Provides ancillary debug output to console
namespace dimmer Event namespace. Makes sure module teardown does not effect other events attached to an element.
errors
errors : { method : 'The method you called is not defined.' }