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.

384 lines
10 KiB

  1. ---
  2. layout : 'default'
  3. css : 'side'
  4. title : 'Sidebar'
  5. description : 'A sidebar is a menu hidden beside page content'
  6. type : 'UI Module'
  7. ---
  8. <div class="ui red vertical demo sidebar menu">
  9. <a class="item">
  10. <i class="home icon"></i>
  11. Home
  12. </a>
  13. <a class="active item">
  14. <i class="heart icon"></i>
  15. Current Section
  16. </a>
  17. <a class="item">
  18. <i class="facebook icon"></i>
  19. Like us on Facebook
  20. </a>
  21. <div class="item">
  22. <b>More</b>
  23. <div class="menu">
  24. <a class="item">About</a>
  25. <a class="item">Contact Us</a>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="ui right sidebar inverted red vertical menu">
  30. <div class="header item">Right Sidebar menu</div>
  31. <a class="item">One</a>
  32. <a class="item">Two</a>
  33. <a class="item">Three</a>
  34. </div>
  35. <div class="ui top inverted teal sidebar menu">
  36. <div class="header item">Top Sidebar menu</div>
  37. <a class="item">One</a>
  38. <a class="item">Two</a>
  39. <a class="item">Three</a>
  40. </div>
  41. <div class="ui bottom inverted sidebar menu">
  42. <div class="header item">Bottom Sidebar menu</div>
  43. <a class="item">One</a>
  44. <a class="item">Two</a>
  45. <a class="item">Three</a>
  46. </div>
  47. <%- @partial('header') %>
  48. <div class="main container">
  49. <div class="peek">
  50. <div class="ui vertical pointing secondary menu">
  51. <a class="active item">Initializing</a>
  52. <a class="item">Usage</a>
  53. <a class="item">Variations</a>
  54. <a class="item">Behavior</a>
  55. <a class="item">Settings</a>
  56. </div>
  57. </div>
  58. <h2 class="ui dividing header">Initializing</h2>
  59. <p>Any content can be used as a sidebar by adding the class <code>ui sidebar</code> and initializing the menu in javascript.</p>
  60. <div class="ui ignored warning message">
  61. <div class="header">Fixed Position Snafoos</div>
  62. Fixed position content may have issues changing it's position when a sidebar appears. There are two solutions
  63. <ul class="ui list">
  64. <li>Specify your fixed content without using the css left or top properties.</li>
  65. <li>Apply styles on the fixed element to adjust its position when the sidebar appears. You can do this by descending from the body tag which receives the class <code>(direction) pushed</code> when the view is moved.</li>
  66. </ul>
  67. </div>
  68. <div class="code" data-label="true" data-type="html">
  69. <div class="ui sidebar">
  70. Any content in the world
  71. </div>
  72. </div>
  73. <div class="code" data-label="true" data-type="javascript">
  74. $('.ui.sidebar')
  75. .sidebar()
  76. ;
  77. </div>
  78. <h2 class="ui dividing header">Usage</h2>
  79. <div class="no example">
  80. <h4 class="ui header">Showing a sidebar</h4>
  81. <p>A sidebar can be shown, hidden, or toggled. In the following examples sidebar is used in conjunction with <a href="/collections/menu.html">ui menu</a> to display a vertical menu as a sidebar.</p>
  82. <div class="code" data-type="html" data-title="Example HTML">
  83. <div class="ui red vertical demo sidebar menu">
  84. <a class="item">
  85. <i class="home icon"></i>
  86. Home
  87. </a>
  88. <a class="active item">
  89. <i class="heart icon"></i>
  90. Current Section
  91. </a>
  92. <a class="item">
  93. <i class="facebook icon"></i>
  94. Like us on Facebook
  95. </a>
  96. <div class="item">
  97. <b>More</b>
  98. <div class="menu">
  99. <a class="item">About</a>
  100. <a class="item">Contact Us</a>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="code" data-demo="true" data-type="javascript">
  106. $('.demo.sidebar')
  107. .sidebar('toggle')
  108. ;
  109. </div>
  110. </div>
  111. <div class="no example">
  112. <h4 class="ui header">Triggering show/hide with other content</h4>
  113. <p>For convenience calling attach events will allow you to bind events. By default this will toggle the sidebar in and out of view on click</p>
  114. <div class="code" data-demo="true">
  115. $('.demo.sidebar')
  116. .sidebar('attach events', '.toggle.button')
  117. ;
  118. $('.toggle.button')
  119. .removeClass('disabled')
  120. ;
  121. </div>
  122. <div class="ui disabled teal toggle button">
  123. <i class="left arrow icon"></i>
  124. Trigger Sidebar
  125. </div>
  126. </div>
  127. <div class="no example">
  128. <h4 class="ui header">Triggering custom action with other content</h4>
  129. <p>You can also however specify what action should occur when the element is clicked</p>
  130. <div class="code" data-demo="true">
  131. $('.demo.sidebar')
  132. .sidebar('attach events', '.open.button', 'show')
  133. ;
  134. $('.open.button')
  135. .removeClass('disabled')
  136. ;
  137. </div>
  138. <div class="ui disabled teal open button">
  139. <i class="left arrow icon"></i>
  140. Open Sidebar
  141. </div>
  142. </div>
  143. <h2 class="ui dividing header">Variations</h2>
  144. <div class="no example">
  145. <h4 class="ui header">Floating</h4>
  146. <p>A sidebar can appear floating above content</p>
  147. <div class="code" data-demo="true">
  148. $('.demo.sidebar')
  149. .addClass('floating')
  150. .sidebar('toggle')
  151. ;
  152. </div>
  153. </div>
  154. <div class="no example">
  155. <h4 class="ui header">Direction</h4>
  156. <p>A sidebar can appear on any side of content</p>
  157. <div class="code" data-type="html">
  158. <!-- Assumes left if none specified -->
  159. <div class="ui sidebar"></div>
  160. <div class="ui top sidebar"></div>
  161. <div class="ui right sidebar"></div>
  162. <div class="ui bottom sidebar"></div>
  163. </div>
  164. <div class="code" data-demo="true">
  165. $('.direction.button')
  166. .on('click', function() {
  167. $('.sidebar')
  168. .filter('.' + $(this).data('direction') )
  169. .sidebar('toggle')
  170. ;
  171. })
  172. ;
  173. $('.direction.button')
  174. .removeClass('disabled')
  175. ;
  176. </div>
  177. <div class="ui buttons">
  178. <div class="ui disabled direction button" data-direction="top">
  179. Top
  180. </div>
  181. <div class="ui disabled direction button" data-direction="right">
  182. Right
  183. </div>
  184. <div class="ui disabled direction button" data-direction="bottom">
  185. Bottom
  186. </div>
  187. </div>
  188. </div>
  189. <div class="no example">
  190. <h4 class="ui header">Overlay</h4>
  191. <p>A sidebar can overlay page content instead of pushing it to the side</p>
  192. <div class="code" data-demo="true">
  193. $('.demo.sidebar')
  194. .sidebar('setting', 'overlay', true)
  195. .sidebar('toggle')
  196. .sidebar('setting', 'overlay', false)
  197. ;
  198. </div>
  199. </div>
  200. <h2 class="ui dividing header">Behavior</h2>
  201. All the following behaviors can be called using the syntax <code>$('.foo').sidebar('behavior name', argumentOne, argumentTwo)</code>
  202. <table class="ui definition celled table segment">
  203. <tr>
  204. <td>attach events(selector, event)</td>
  205. <td>Attaches sidebar action to given selector. Default event if none specified is toggle</td>
  206. </tr>
  207. <tr>
  208. <td>show</td>
  209. <td>Shows sidebar</td>
  210. </tr>
  211. <tr>
  212. <td>hide</td>
  213. <td>Hides sidebar</td>
  214. </tr>
  215. <tr>
  216. <td>toggle</td>
  217. <td>Toggles visibility of sidebar</td>
  218. </tr>
  219. <tr>
  220. <td>is open</td>
  221. <td>Returns whether sidebar is open</td>
  222. </tr>
  223. <tr>
  224. <td>is closed</td>
  225. <td>Returns whether sidebar is closed</td>
  226. </tr>
  227. <tr>
  228. <td>push page</td>
  229. <td>Pushes page content to be visible alongside sidebar</td>
  230. </tr>
  231. <tr>
  232. <td>get direction</td>
  233. <td>Returns direction of current sidebar</td>
  234. </tr>
  235. <tr>
  236. <td>pull page</td>
  237. <td>Returns page content to original position</td>
  238. </tr>
  239. <tr>
  240. <td>add body css</td>
  241. <td>Adds stylesheet to page head to trigger sidebar animations</td>
  242. </tr>
  243. <tr>
  244. <td>remove body css</td>
  245. <td>Removes any inline stylesheets for sidebar animation</td>
  246. </tr>
  247. <tr>
  248. <td>get transition event</td>
  249. <td>Returns vendor prefixed transition end event</td>
  250. </tr>
  251. </table>
  252. <h2 class="ui dividing header">Settings</h2>
  253. <h3 class="ui header">
  254. Transition Settings
  255. <div class="sub header">Form settings modify the transition behavior</div>
  256. </h3>
  257. <table class="ui red celled sortable definition table segment">
  258. <thead>
  259. <th>Setting</th>
  260. <th class="four wide">Default</th>
  261. <th>Description</th>
  262. </thead>
  263. <tbody>
  264. <tr>
  265. <td>overlay</td>
  266. <td>false</td>
  267. <td>Whether sidebar should overlay page instead of pushing page to the side</td>
  268. </tr>
  269. <tr>
  270. <td>useCSS</td>
  271. <td>true</td>
  272. <td>Whether to use css animations or fallback javascript animations</td>
  273. </tr>
  274. <tr>
  275. <td>duration</td>
  276. <td>300</td>
  277. <td>Duration of side bar animation</td>
  278. </tr>
  279. </tbody>
  280. </table>
  281. <h3 class="ui header">
  282. DOM Settings
  283. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  284. </h3>
  285. <table class="ui celled purple definition table segment">
  286. <thead>
  287. <th>Setting</th>
  288. <th class="six wide">Default</th>
  289. <th>Description</th>
  290. </thead>
  291. <tbody>
  292. <tr>
  293. <td>namespace</td>
  294. <td>sidebar</td>
  295. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  296. </tr>
  297. <tr>
  298. <td>className</td>
  299. <td>
  300. <div class="code">
  301. className: {
  302. active : 'active',
  303. pushed : 'pushed',
  304. top : 'top',
  305. left : 'left',
  306. right : 'right',
  307. bottom : 'bottom'
  308. }
  309. </div>
  310. </td>
  311. <td>Class names used to attach style to state</td>
  312. </tr>
  313. </tbody>
  314. </table>
  315. <div class="ui horizontal divider"><i class="icon setting"></i></div>
  316. <h3 class="ui header">
  317. Debug Settings
  318. <div class="sub header">Debug settings controls debug output to the console</div>
  319. </h3>
  320. <table class="ui blue celled sortable definition table segment">
  321. <thead>
  322. <th>Setting</th>
  323. <th class="four wide">Default</th>
  324. <th>Description</th>
  325. </thead>
  326. <tbody>
  327. <tr>
  328. <td>name</td>
  329. <td>Sidebar</td>
  330. <td>Name used in debug logs</td>
  331. </tr>
  332. <tr>
  333. <td>debug</td>
  334. <td>True</td>
  335. <td>Provides standard debug output to console</td>
  336. </tr>
  337. <tr>
  338. <td>performance</td>
  339. <td>True</td>
  340. <td>Provides standard debug output to console</td>
  341. </tr>
  342. <tr>
  343. <td>verbose</td>
  344. <td>True</td>
  345. <td>Provides ancillary debug output to console</td>
  346. </tr>
  347. <tr>
  348. <td>errors</td>
  349. <td colspan="2">
  350. <div class="code">
  351. error : {
  352. method : 'The method you called is not defined.',
  353. notFound : 'There were no elements that matched the specified selector'
  354. }
  355. </div>
  356. </td>
  357. </tr>
  358. </tbody>
  359. </table>
  360. </div>
  361. </body>
  362. </html>