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.

528 lines
16 KiB

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