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.

524 lines
16 KiB

  1. ---
  2. layout : 'default'
  3. css : ''
  4. title : 'Dimmer'
  5. description : "Dimmers hide distractions to focus user's attention on particular content"
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/dimmer.js"></script>
  9. <div class="ui page dimmer">
  10. <div class="content">
  11. <div class="center">
  12. <h2 class="ui inverted icon header">
  13. <i class="icon circular inverted emphasized green mail"></i>
  14. You're all signed up for the weekly dog tips newsletter!
  15. <div class="sub header">Your first edition will be sent on January 22</div>
  16. </h2>
  17. </div>
  18. </div>
  19. </div>
  20. <%- @partial('header', { tabs: 'module' }) %>
  21. <div class="main container">
  22. <div class="active ui tab" data-tab="definition">
  23. <div class="peek">
  24. <div class="ui vertical pointing secondary menu">
  25. <a class="item">Types</a>
  26. <a class="item">States</a>
  27. <a class="item">Variations</a>
  28. </div>
  29. </div>
  30. <h2 class="ui dividing header">Types</h2>
  31. <div class="example">
  32. <h4 class="ui header">Content Dimmer</h4>
  33. <p>A dimmer can display content</p>
  34. <div class="ui ignored info message">Content must be included inside <code>.content .center</code> to display centered correctly in the modal.</div>
  35. <div class="ui segment">
  36. <h4 class="ui dividing header">
  37. <i class="photo icon"></i>Dog Photos
  38. </h4>
  39. <img src="/images/demo/item1.jpg">
  40. <img src="/images/demo/item2.jpg">
  41. <div class="ui dimmer">
  42. <div class="content">
  43. <div class="center">
  44. <h2 class="ui inverted icon header">
  45. <i class="icon circular inverted emphasized red heart"></i>
  46. Your poodle photo uploaded successfully!
  47. </h2>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="ui icon buttons">
  53. <div class="ui show button"><i class="plus icon"></i></div>
  54. <div class="ui hide button"><i class="minus icon"></i></div>
  55. </div>
  56. <div class="existing code">
  57. <div class="ui dimmer">
  58. <div class="content">
  59. <div class="center">
  60. <h2 class="ui inverted icon header">
  61. <i class="icon circular inverted emphasized red heart"></i>
  62. Your poodle photo uploaded successfully!
  63. </h2>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="example">
  70. <h4 class="ui header">Page Dimmer</h4>
  71. <p>A dimmer can be formatted to be fixed to the page</p>
  72. <div class="existing code">
  73. <div class="ui page dimmer">
  74. <div class="content">
  75. <div class="center">Hello</div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class="ui page button"><i class="plus icon"></i> Show</div>
  80. </div>
  81. <h2 class="ui dividing header">States</h2>
  82. <div class="example">
  83. <h4 class="ui header">Active</h4>
  84. <p>An active dimmer will dim its parent container</p>
  85. <div class="ui segment">
  86. <div class="ui active dimmer"></div>
  87. </div>
  88. </div>
  89. <div class="example">
  90. <h4 class="ui header">Disabled</h4>
  91. <p>A disabled dimmer cannot be activated</p>
  92. <div class="ui segment">
  93. <div class="ui disabled dimmer"></div>
  94. </div>
  95. </div>
  96. <h2 class="ui dividing header">Variations</h2>
  97. <h3>Dimmer</h3>
  98. <div class="example">
  99. <h4 class="ui header">Simple Dimmer</h4>
  100. <p>A dimmer can be controlled without javascript</p>
  101. <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>
  102. <div class="ui dimmable dimmed segment">
  103. <div class="ui simple dimmer"></div>
  104. <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>
  105. <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>
  106. </div>
  107. </div>
  108. <div class="example">
  109. <h4 class="ui header">Inverted Dimmer</h4>
  110. <p>A dimmer can be formatted to have its colors inverted</p>
  111. <div class="ui segment">
  112. <div class="ui inverted dimmer"></div>
  113. <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>
  114. <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>
  115. </div>
  116. <div class="ignore ui icon buttons">
  117. <div class="ui show button"><i class="plus icon"></i></div>
  118. <div class="ui hide button"><i class="minus icon"></i></div>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="ui tab" data-tab="examples">
  123. <div class="event example">
  124. <h4 class="ui header">Dimmer Events</h4>
  125. <p>A dimmer can trigger a visibility change on an event</p>
  126. <div class="evaluated code">
  127. $('.event.example .image')
  128. .dimmer({
  129. on: 'hover'
  130. })
  131. ;
  132. </div>
  133. <div class="ui medium image">
  134. <div class="ui dimmer">
  135. <div class="content">
  136. <div class="center">
  137. <h2 class="ui header">Puppy</h2>
  138. <div class="ui green button">Vote</div>
  139. <a class="ui button">View</a>
  140. </div>
  141. </div>
  142. </div>
  143. <img src="/images/demo/highres.jpg">
  144. </div>
  145. <div class="ui circular image">
  146. <div class="ui dimmer">
  147. <div class="content">
  148. <div class="center">
  149. <div class="ui green button">Vote</div>
  150. <a class="ui button">View</a>
  151. </div>
  152. </div>
  153. </div>
  154. <img src="/images/demo/photo2.jpg">
  155. </div>
  156. </div>
  157. <div class="example">
  158. <h4 class="ui header">Loaders inside Dimmers</h4>
  159. <p>Any loader inside a dimmer will automatically use an appropriate color to match</p>
  160. <div class="ui segment">
  161. <div class="ui inverted dimmer">
  162. <div class="ui text loader">Loading</div>
  163. </div>
  164. <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>
  165. <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>
  166. </div>
  167. <div class="ignore ui icon buttons">
  168. <div class="ui show button"><i class="plus icon"></i></div>
  169. <div class="ui hide button"><i class="minus icon"></i></div>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="ui tab" data-tab="usage">
  174. <h2 class="ui dividing header">Usage</h2>
  175. <h3 class="ui header">Display</h3>
  176. <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>
  177. <div class="ignore code">
  178. // these two are the same
  179. $('.ui.dimmable)
  180. .dimmer('show')
  181. ;
  182. $('.ui.dimmable .dimmer')
  183. .dimmer('show')
  184. ;
  185. </div>
  186. <h3 class="ui header">Creating Dimmers</h3>
  187. <p>If a dimmer does not exist inside the element it will be created on first use.</p>
  188. <div class="code" data-demo="true">
  189. $('h3')
  190. .dimmer('toggle')
  191. ;
  192. </div>
  193. <h3 class="ui header">Showing a specific dimmer</h3>
  194. <p>If a dimmer is already inside an element, you can call behavior on the dimmable section or the dimmer itself.</p>
  195. <div class="code" data-demo="true">
  196. // If a dimmer exists on a page, you can make it appear by calling it directly
  197. $('.page.dimmer:first')
  198. .dimmer('toggle')
  199. ;
  200. </div>
  201. <h2 class="ui dividing header">Behavior</h2>
  202. <p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
  203. <div class="code">
  204. $('.your.element')
  205. .dimmer('behavior name', argumentOne, argumentTwo)
  206. ;
  207. </div>
  208. <table class="ui definition celled sortable table segment">
  209. <thead>
  210. <th>Behavior</th>
  211. <th>Description</th>
  212. </thead>
  213. <tbody>
  214. <tr>
  215. <td>add content (element)</td>
  216. <td>Detaches a given element from DOM and reattaches element inside dimmer</td>
  217. </tr>
  218. <tr>
  219. <td>show</td>
  220. <td>Shows dimmer</td>
  221. </tr>
  222. <tr>
  223. <td>hide</td>
  224. <td>Hides dimmer</td>
  225. </tr>
  226. <tr>
  227. <td>toggle</td>
  228. <td>Toggles current dimmer visibility</td>
  229. </tr>
  230. <tr>
  231. <td>get duration</td>
  232. <td>Returns current duration for show or hide event depending on current visibility</td>
  233. </tr>
  234. <tr>
  235. <td>get dimmer</td>
  236. <td>Returns DOM element for dimmer</td>
  237. </tr>
  238. <tr>
  239. <td>has dimmer</td>
  240. <td>Returns whether current dimmable has a dimmer</td>
  241. </tr>
  242. <tr>
  243. <td>is dimmer</td>
  244. <td>Whether current element is a dimmer</td>
  245. </tr>
  246. <tr>
  247. <td>is dimmable</td>
  248. <td>Whether current element is a dimmable section</td>
  249. </tr>
  250. <tr>
  251. <td>is active</td>
  252. <td>Whether section's dimmer is active</td>
  253. </tr>
  254. <tr>
  255. <td>is animating</td>
  256. <td>Whether dimmer is animating</td>
  257. </tr>
  258. <tr>
  259. <td>is page</td>
  260. <td>Whether dimmable section is <code>body</code></td>
  261. </tr>
  262. <tr>
  263. <td>is enabled</td>
  264. <td>Whether dimmer is not disabled</td>
  265. </tr>
  266. <tr>
  267. <td>is disabled</td>
  268. <td>Whether dimmer is disabled</td>
  269. </tr>
  270. <tr>
  271. <td>is page dimmer</td>
  272. <td>Whether dimmer is a page dimmer</td>
  273. </tr>
  274. <tr>
  275. <td>set active</td>
  276. <td>Sets page dimmer to active</td>
  277. </tr>
  278. <tr>
  279. <td>set dimmable</td>
  280. <td>Sets an element as a dimmable section</td>
  281. </tr>
  282. <tr>
  283. <td>set dimmed</td>
  284. <td>Sets a dimmable section as dimmed</td>
  285. </tr>
  286. <tr>
  287. <td>set page dimmer</td>
  288. <td>Sets current dimmer as a page dimmer</td>
  289. </tr>
  290. <tr>
  291. <td>set disabled</td>
  292. <td>Sets a dimmer as disabled</td>
  293. </tr>
  294. </tbody>
  295. </table>
  296. </div>
  297. <div class="ui tab" data-tab="settings">
  298. <h3 class="ui header">
  299. Dimmer Settings
  300. <div class="sub header">Dimmer settings modify its behavior</div>
  301. </h3>
  302. <table class="ui sortable celled definition table segment">
  303. <thead>
  304. <th>Setting</th>
  305. <th class="four wide">Default</th>
  306. <th>Description</th>
  307. </thead>
  308. <tbody>
  309. <tr>
  310. <td>closable</td>
  311. <td class="six wide">true</td>
  312. <td>Whether clicking on the dimmer should close it automatically</td>
  313. </tr>
  314. <tr>
  315. <td>on</td>
  316. <td class="six wide">false</td>
  317. <td>Can be set to <code>hover</code> or <code>click</code> to show/hide dimmer on dimmable event</td>
  318. </tr>
  319. <tr>
  320. <td>duration</td>
  321. <td>
  322. <div class="code">
  323. duration : {
  324. show : 500,
  325. hide : 500
  326. }
  327. </div>
  328. </td>
  329. <td>Animation duration of dimming. If an integer is used, that value will apply to both show and hide animations.</td>
  330. </tr>
  331. <tr>
  332. <td>transition</td>
  333. <td>
  334. Fade
  335. </td>
  336. <td>Named transition to use when animating menu in and out. Fade and slide down are available without including <a href="/modules/transition.html">ui transitions</a></td>
  337. </tr>
  338. </tbody>
  339. </tbody>
  340. </table>
  341. <h3 class="ui header">
  342. Callbacks
  343. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  344. </h3>
  345. <table class="ui sortable celled definition table segment">
  346. <thead>
  347. <th class="four wide">Setting</th>
  348. <th>Context</th>
  349. <th>Description</th>
  350. </thead>
  351. <tbody>
  352. <tr>
  353. <td>onShow</td>
  354. <td>dimmable</td>
  355. <td>Callback on element show</td>
  356. </tr>
  357. <tr>
  358. <td>onHide</td>
  359. <td>dimmable</td>
  360. <td>Callback on element hide</td>
  361. </tr>
  362. <tr>
  363. <td>onChange</td>
  364. <td>dimmable</td>
  365. <td>Callback on element show or hide</td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. <h3 class="ui header">
  370. Templates
  371. <div class="sub header">Templates are used to generate DOM elements</div>
  372. </h3>
  373. <table class="ui sortable celled definition table segment">
  374. <thead>
  375. <th class="three wide">Generates</th>
  376. <th>Default</th>
  377. </thead>
  378. <tbody>
  379. <tr>
  380. <td>dimmer</td>
  381. <td>
  382. <div class="code" data-type="javascript">
  383. function() {
  384. return $('<div />').attr('class', 'ui dimmer');
  385. }
  386. </div>
  387. </td>
  388. </tr>
  389. </tbody>
  390. </table>
  391. <h3 class="ui header">
  392. DOM Settings
  393. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  394. </h3>
  395. <table class="ui sortable celled definition table segment">
  396. <thead>
  397. <th>Setting</th>
  398. <th class="six wide">Default</th>
  399. <th>Description</th>
  400. </thead>
  401. <tbody>
  402. <tr>
  403. <td>namespace</td>
  404. <td>dimmer</td>
  405. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  406. </tr>
  407. <tr>
  408. <td>selector</td>
  409. <td>
  410. <div class="code" data-type="css">
  411. selector: {
  412. dimmable : '.ui.dimmable',
  413. dimmer : '.ui.dimmer',
  414. content : '.ui.dimmer > .content, .ui.dimmer > .content > .center'
  415. }
  416. </div>
  417. </td>
  418. <td>Object containing selectors used by module.</td>
  419. </tr>
  420. <tr>
  421. <td>className</td>
  422. <td>
  423. <div class="code">
  424. className : {
  425. active : 'active',
  426. dimmable : 'ui dimmable',
  427. dimmed : 'dimmed',
  428. disabled : 'disabled',
  429. pageDimmer : 'page',
  430. hide : 'hide',
  431. show : 'show',
  432. transition : 'transition'
  433. }
  434. </div>
  435. </td>
  436. <td>Class names used to attach style to state</td>
  437. </tr>
  438. </tbody>
  439. </table>
  440. <h3 class="ui header">
  441. Debug Settings
  442. <div class="sub header">Debug settings controls debug output to the console</div>
  443. </h3>
  444. <table class="ui sortable celled definition table segment">
  445. <thead>
  446. <th>Setting</th>
  447. <th class="four wide">Default</th>
  448. <th>Description</th>
  449. </thead>
  450. <tbody>
  451. <tr>
  452. <td>name</td>
  453. <td>Dimmer</td>
  454. <td>Name used in debug logs</td>
  455. </tr>
  456. <tr>
  457. <td>debug</td>
  458. <td>True</td>
  459. <td>Provides standard debug output to console</td>
  460. </tr>
  461. <tr>
  462. <td>performance</td>
  463. <td>True</td>
  464. <td>Provides standard debug output to console</td>
  465. </tr>
  466. <tr>
  467. <td>verbose</td>
  468. <td>True</td>
  469. <td>Provides ancillary debug output to console</td>
  470. </tr>
  471. <tr>
  472. <td>errors</td>
  473. <td colspan="2">
  474. <div class="code">
  475. error : {
  476. method : 'The method you called is not defined.'
  477. }
  478. </div>
  479. </td>
  480. </tr>
  481. </tbody>
  482. </table>
  483. </div>
  484. </div>
  485. </body>
  486. </html>