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.

362 lines
11 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') %>
  21. <div class="main container">
  22. <div class="peek">
  23. <div class="ui vertical pointing secondary menu">
  24. <a class="active item">Usage</a>
  25. <a class="item">Types</a>
  26. <a class="item">States</a>
  27. <a class="item">Variations</a>
  28. <a class="item">Behavior</a>
  29. <a class="item">Settings</a>
  30. </div>
  31. </div>
  32. <h2 class="ui dividing header">Usage</h2>
  33. <h4 class="ui header">Dimming a section</h4>
  34. <p>Any element can be dimmed using a dimmer.</p>
  35. <div class="ignored ui info message">If a dimmer does not exist inside the element it will be created on first use.</div>
  36. <div class="code" data-demo="true">
  37. $('.segment:first')
  38. .dimmer('toggle')
  39. ;
  40. </div>
  41. <div class="ui divider"></div>
  42. <h4 class="ui header">Showing a specific dimmer</h4>
  43. <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>
  44. <div class="code" data-demo="true">
  45. // If a dimmer exists on a page, you can make it appear by calling it directly
  46. $('.page.dimmer:first')
  47. .dimmer('toggle')
  48. ;
  49. </div>
  50. <h2 class="ui dividing header">Types</h2>
  51. <div class="example">
  52. <h4 class="ui header">Content Dimmer</h4>
  53. <p>A dimmer can display content</p>
  54. <div class="ui ignored info message">Content must be included inside <code>.content .center</code> to display centered correctly in the modal.</div>
  55. <div class="ui segment">
  56. <h4 class="ui dividing header">
  57. <i class="photo icon"></i>Dog Photos
  58. </h4>
  59. <img src="/images/demo/item1.jpg">
  60. <img src="/images/demo/item2.jpg">
  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 class="ui icon buttons">
  73. <div class="ui show button"><i class="plus icon"></i></div>
  74. <div class="ui hide button"><i class="minus icon"></i></div>
  75. </div>
  76. <div class="existing code">
  77. <div class="ui dimmer">
  78. <div class="content">
  79. <div class="center">
  80. <h2 class="ui inverted icon header">
  81. <i class="icon circular inverted emphasized red heart"></i>
  82. Your poodle photo uploaded successfully!
  83. </h2>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="example">
  90. <h4 class="ui header">Page Dimmer</h4>
  91. <p>A dimmer can be formatted to be fixed to the page</p>
  92. <div class="existing code">
  93. <div class="ui page dimmer">
  94. <div class="content">
  95. <div class="center">Hello</div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="ui page button"><i class="plus icon"></i> Show</div>
  100. </div>
  101. <h2 class="ui dividing header">States</h2>
  102. <div class="example">
  103. <h4 class="ui header">Active</h4>
  104. <p>An active dimmer will dim its parent container</p>
  105. <div class="ui segment">
  106. <div class="ui active dimmer"></div>
  107. </div>
  108. </div>
  109. <div class="example">
  110. <h4 class="ui header">Disabled</h4>
  111. <p>A disabled dimmer cannot be activated</p>
  112. <div class="ui segment">
  113. <div class="ui disabled dimmer"></div>
  114. </div>
  115. </div>
  116. <h2 class="ui dividing header">Variations</h2>
  117. <h3>Dimmer</h3>
  118. <div class="example">
  119. <h4 class="ui header">Simple Dimmer</h4>
  120. <p>A dimmer can be controlled without javascript</p>
  121. <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>
  122. <div class="ui dimmable dimmed segment">
  123. <div class="ui simple dimmer"></div>
  124. <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>
  125. <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>
  126. </div>
  127. </div>
  128. <div class="example">
  129. <h4 class="ui header">Inverted Dimmer</h4>
  130. <p>A dimmer can be formatted to have its colors inverted</p>
  131. <div class="ui segment">
  132. <div class="ui inverted dimmer"></div>
  133. <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>
  134. <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>
  135. </div>
  136. <div class="ignore ui icon buttons">
  137. <div class="ui show button"><i class="plus icon"></i></div>
  138. <div class="ui hide button"><i class="minus icon"></i></div>
  139. </div>
  140. </div>
  141. <h2 class="ui dividing header">Behavior</h2>
  142. <p>All the following behaviors can be called using the syntax <code>$('.foo').dimmer('behavior name', argumentOne, argumentTwo)</code></p>
  143. <table class="ui definition celled table segment">
  144. <tr>
  145. <td>add content (element)</td>
  146. <td>Detatches a given element from DOM and reattaches element inside dimmer</td>
  147. </tr>
  148. <tr>
  149. <td>show</td>
  150. <td>Shows dimmer</td>
  151. </tr>
  152. <tr>
  153. <td>hide</td>
  154. <td>Hides dimmer</td>
  155. </tr>
  156. <tr>
  157. <td>toggle</td>
  158. <td>Toggles current dimmer visibility</td>
  159. </tr>
  160. <tr>
  161. <td>get duration</td>
  162. <td>Returns current duration for show or hide event depending on current visibility</td>
  163. </tr>
  164. <tr>
  165. <td>get dimmer</td>
  166. <td>Returbns DOM element for dimmer</td>
  167. </tr>
  168. <tr>
  169. <td>has dimmer</td>
  170. <td>Returns whether current dimmable has a dimmer</td>
  171. </tr>
  172. <tr>
  173. <td>is dimmer</td>
  174. <td>Whether current element is a dimmer</td>
  175. </tr>
  176. <tr>
  177. <td>is dimamable</td>
  178. <td>Whether current element is a dimmable section</td>
  179. </tr>
  180. <tr>
  181. <td>is active</td>
  182. <td>Whether section's dimmer is active</td>
  183. </tr>
  184. <tr>
  185. <td>is animating</td>
  186. <td>Whether dimmer is animating</td>
  187. </tr>
  188. <tr>
  189. <td>is page</td>
  190. <td>Whether dimmable section is <code>body</code></td>
  191. </tr>
  192. <tr>
  193. <td>is enabled</td>
  194. <td>Whether dimmer is not disabled</td>
  195. </tr>
  196. <tr>
  197. <td>is disabled</td>
  198. <td>Whether dimmer is disabled</td>
  199. </tr>
  200. <tr>
  201. <td>is page dimmer</td>
  202. <td>Whether dimmer is a page dimmer</td>
  203. </tr>
  204. <tr>
  205. <td>set active</td>
  206. <td>Sets page dimmer to active</td>
  207. </tr>
  208. <tr>
  209. <td>set dimmable</td>
  210. <td>Sets an element as a dimmable section</td>
  211. </tr>
  212. <tr>
  213. <td>set dimmed</td>
  214. <td>Sets a dimmable section as dimmed</td>
  215. </tr>
  216. <tr>
  217. <td>set page dimmer</td>
  218. <td>Sets current dimmer as a page dimmer</td>
  219. </tr>
  220. <tr>
  221. <td>set disabled</td>
  222. <td>Sets a dimmer as disabled</td>
  223. </tr>
  224. </table>
  225. <div class="no example">
  226. <h4 class="ui header">Display</h4>
  227. <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>
  228. <div class="ignore code">
  229. // these two are the same
  230. $('.ui.dimmable)
  231. .dimmer('show')
  232. ;
  233. $('.ui.dimmable .dimmer')
  234. .dimmer('show')
  235. ;
  236. // these two as well
  237. $('.ui.dimmable)
  238. .dimmer('hide')
  239. ;
  240. $('.ui.dimmable dimmer')
  241. .dimmer('hide')
  242. ;
  243. </div>
  244. </div>
  245. <h2 class="ui dividing header">Settings</h2>
  246. <table class="ui green celled table segment">
  247. <thead>
  248. <th colspan="3">Dimmer Settings</th>
  249. </thead>
  250. <tbody>
  251. <tr>
  252. <td>closable</td>
  253. <td class="six wide">true</td>
  254. <td>Whether clicking on the dimmer should close it automatically</td>
  255. </tr>
  256. <tr>
  257. <td>duration</td>
  258. <td>
  259. <div class="code">
  260. duration : {
  261. show : 500,
  262. hide : 500
  263. }
  264. </div>
  265. </td>
  266. <td>Animation duration of dimming. If an integer is used, that value will apply to both show and hide animations.</td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. <table class="ui teal celled table segment">
  271. <thead>
  272. <th colspan="3">Callbacks</th>
  273. </thead>
  274. <tbody>
  275. <tr>
  276. <td>onInit</td>
  277. <td>None</td>
  278. <td>Callback after a dimmer html is generated.</td>
  279. </tr>
  280. <tr>
  281. <td>onShow</td>
  282. <td>None</td>
  283. <td>Callback after a dimmer section is shown.</td>
  284. </tr>
  285. <tr>
  286. <td>onHide</td>
  287. <td>None</td>
  288. <td>Callback after a dimmer section is hidden.</td>
  289. </tr>
  290. </tbody>
  291. </table>
  292. <table class="ui blue celled table segment">
  293. <thead>
  294. <th colspan="3">UI Module Settings</th>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td>Name</td>
  299. <td>Dimmer</td>
  300. <td>Name used in debug logs</td>
  301. </tr>
  302. <tr>
  303. <td>debug</td>
  304. <td>True</td>
  305. <td>Provides standard debug output to console</td>
  306. </tr>
  307. <tr>
  308. <td>performance</td>
  309. <td>False</td>
  310. <td>Provides standard debug output to console</td>
  311. </tr>
  312. <tr>
  313. <td>verbose</td>
  314. <td>False</td>
  315. <td>Provides ancillary debug output to console</td>
  316. </tr>
  317. <tr>
  318. <td>namespace</td>
  319. <td>dimmer</td>
  320. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  321. </tr>
  322. <tr>
  323. <td>errors</td>
  324. <td colspan="2">
  325. <div class="code">
  326. errors : {
  327. method : 'The method you called is not defined.'
  328. }
  329. </div>
  330. </td>
  331. </tr>
  332. </tbody>
  333. </table>
  334. </div>
  335. </body>
  336. </html>