You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

371 lines
11 KiB

---
layout : 'default'
css : ''
title : 'Dimmer'
description : "Dimmers hide distractions to focus user's attention on particular content"
type : 'UI Module'
---
<script src="/javascript/dimmer.js"></script>
<div class="ui page dimmer">
<div class="content">
<div class="center">
<h2 class="ui inverted icon header">
<i class="icon circular inverted emphasized green mail"></i>
You're all signed up for the weekly dog tips newsletter!
<div class="sub header">Your first edition will be sent on January 22</div>
</h2>
</div>
</div>
</div>
<%- @partial('header', { tabs: 'module' }) %>
<div class="main container">
<div class="active ui tab" data-tab="definition">
<div class="peek">
<div class="ui vertical pointing secondary menu">
<a class="item">Types</a>
<a class="item">States</a>
<a class="item">Variations</a>
</div>
</div>
<h2 class="ui dividing header">Types</h2>
<div class="example">
<h4 class="ui header">Content Dimmer</h4>
<p>A dimmer can display content</p>
<div class="ui ignored info message">Content must be included inside <code>.content .center</code> to display centered correctly in the modal.</div>
<div class="ui segment">
<h4 class="ui dividing header">
<i class="photo icon"></i>Dog Photos
</h4>
<img src="/images/demo/item1.jpg">
<img src="/images/demo/item2.jpg">
<div class="ui dimmer">
<div class="content">
<div class="center">
<h2 class="ui inverted icon header">
<i class="icon circular inverted emphasized red heart"></i>
Your poodle photo uploaded successfully!
</h2>
</div>
</div>
</div>
</div>
<div class="ui icon buttons">
<div class="ui show button"><i class="plus icon"></i></div>
<div class="ui hide button"><i class="minus icon"></i></div>
</div>
<div class="existing code">
<div class="ui dimmer">
<div class="content">
<div class="center">
<h2 class="ui inverted icon header">
<i class="icon circular inverted emphasized red heart"></i>
Your poodle photo uploaded successfully!
</h2>
</div>
</div>
</div>
</div>
</div>
<div class="example">
<h4 class="ui header">Page Dimmer</h4>
<p>A dimmer can be formatted to be fixed to the page</p>
<div class="existing code">
<div class="ui page dimmer">
<div class="content">
<div class="center">Hello</div>
</div>
</div>
</div>
<div class="ui page button"><i class="plus icon"></i> Show</div>
</div>
<h2 class="ui dividing header">States</h2>
<div class="example">
<h4 class="ui header">Active</h4>
<p>An active dimmer will dim its parent container</p>
<div class="ui segment">
<div class="ui active dimmer"></div>
</div>
</div>
<div class="example">
<h4 class="ui header">Disabled</h4>
<p>A disabled dimmer cannot be activated</p>
<div class="ui segment">
<div class="ui disabled dimmer"></div>
</div>
</div>
<h2 class="ui dividing header">Variations</h2>
<h3>Dimmer</h3>
<div class="example">
<h4 class="ui header">Simple Dimmer</h4>
<p>A dimmer can be controlled without javascript</p>
<div class="ignored ui info message">Having any parent element receive the class <code>ui dimmable dimmed</code> will trigger the dimmer to display.</div>
<div class="ui dimmable dimmed segment">
<div class="ui simple dimmer"></div>
<p>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.</p>
<p>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.</p>
</div>
</div>
<div class="example">
<h4 class="ui header">Inverted Dimmer</h4>
<p>A dimmer can be formatted to have its colors inverted</p>
<div class="ui segment">
<div class="ui inverted dimmer"></div>
<p>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.</p>
<p>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.</p>
</div>
<div class="ignore ui icon buttons">
<div class="ui show button"><i class="plus icon"></i></div>
<div class="ui hide button"><i class="minus icon"></i></div>
</div>
</div>
</div>
<div class="ui tab" data-tab="usage">
<h2 class="ui dividing header">Usage</h2>
<h4 class="ui header">Dimming a section</h4>
<p>Any element can be dimmed using a dimmer.</p>
<div class="ignored ui info message">If a dimmer does not exist inside the element it will be created on first use.</div>
<div class="code" data-demo="true">
$('.segment:first')
.dimmer('toggle')
;
</div>
<div class="ui divider"></div>
<h4 class="ui header">Showing a specific dimmer</h4>
<p>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.</p>
<div class="code" data-demo="true">
// If a dimmer exists on a page, you can make it appear by calling it directly
$('.page.dimmer:first')
.dimmer('toggle')
;
</div>
<div class="no example">
<h4 class="ui header">Display</h4>
<p>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.</p>
<div class="ignore code">
// 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')
;
</div>
</div>
<h2 class="ui dividing header">Behavior</h2>
<p>All the following behaviors can be called using the syntax <code>$('.foo').dimmer('behavior name', argumentOne, argumentTwo)</code></p>
<table class="ui definition celled table segment">
<tr>
<td>add content (element)</td>
<td>Detatches a given element from DOM and reattaches element inside dimmer</td>
</tr>
<tr>
<td>show</td>
<td>Shows dimmer</td>
</tr>
<tr>
<td>hide</td>
<td>Hides dimmer</td>
</tr>
<tr>
<td>toggle</td>
<td>Toggles current dimmer visibility</td>
</tr>
<tr>
<td>get duration</td>
<td>Returns current duration for show or hide event depending on current visibility</td>
</tr>
<tr>
<td>get dimmer</td>
<td>Returbns DOM element for dimmer</td>
</tr>
<tr>
<td>has dimmer</td>
<td>Returns whether current dimmable has a dimmer</td>
</tr>
<tr>
<td>is dimmer</td>
<td>Whether current element is a dimmer</td>
</tr>
<tr>
<td>is dimamable</td>
<td>Whether current element is a dimmable section</td>
</tr>
<tr>
<td>is active</td>
<td>Whether section's dimmer is active</td>
</tr>
<tr>
<td>is animating</td>
<td>Whether dimmer is animating</td>
</tr>
<tr>
<td>is page</td>
<td>Whether dimmable section is <code>body</code></td>
</tr>
<tr>
<td>is enabled</td>
<td>Whether dimmer is not disabled</td>
</tr>
<tr>
<td>is disabled</td>
<td>Whether dimmer is disabled</td>
</tr>
<tr>
<td>is page dimmer</td>
<td>Whether dimmer is a page dimmer</td>
</tr>
<tr>
<td>set active</td>
<td>Sets page dimmer to active</td>
</tr>
<tr>
<td>set dimmable</td>
<td>Sets an element as a dimmable section</td>
</tr>
<tr>
<td>set dimmed</td>
<td>Sets a dimmable section as dimmed</td>
</tr>
<tr>
<td>set page dimmer</td>
<td>Sets current dimmer as a page dimmer</td>
</tr>
<tr>
<td>set disabled</td>
<td>Sets a dimmer as disabled</td>
</tr>
</table>
</div>
<div class="ui tab" data-tab="settings">
<h2 class="ui dividing header">Settings</h2>
<table class="ui green celled table segment">
<thead>
<th colspan="3">Dimmer Settings</th>
</thead>
<tbody>
<tr>
<td>closable</td>
<td class="six wide">true</td>
<td>Whether clicking on the dimmer should close it automatically</td>
</tr>
<tr>
<td>duration</td>
<td>
<div class="code">
duration : {
show : 500,
hide : 500
}
</div>
</td>
<td>Animation duration of dimming. If an integer is used, that value will apply to both show and hide animations.</td>
</tr>
</tbody>
</table>
<table class="ui teal celled table segment">
<thead>
<th colspan="3">Callbacks</th>
</thead>
<tbody>
<tr>
<td>onInit</td>
<td>None</td>
<td>Callback after a dimmer html is generated.</td>
</tr>
<tr>
<td>onShow</td>
<td>None</td>
<td>Callback after a dimmer section is shown.</td>
</tr>
<tr>
<td>onHide</td>
<td>None</td>
<td>Callback after a dimmer section is hidden.</td>
</tr>
</tbody>
</table>
<table class="ui blue celled table segment">
<thead>
<th colspan="3">UI Module Settings</th>
</thead>
<tbody>
<tr>
<td>Name</td>
<td>Dimmer</td>
<td>Name used in debug logs</td>
</tr>
<tr>
<td>debug</td>
<td>True</td>
<td>Provides standard debug output to console</td>
</tr>
<tr>
<td>performance</td>
<td>False</td>
<td>Provides standard debug output to console</td>
</tr>
<tr>
<td>verbose</td>
<td>False</td>
<td>Provides ancillary debug output to console</td>
</tr>
<tr>
<td>namespace</td>
<td>dimmer</td>
<td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
</tr>
<tr>
<td>errors</td>
<td colspan="2">
<div class="code">
errors : {
method : 'The method you called is not defined.'
}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>