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.

509 lines
17 KiB

11 years ago
  1. ---
  2. layout : 'default'
  3. css : 'accordion'
  4. title : 'Accordion'
  5. description : 'An accordion displays a single piece of content, while allowing the option of displaying other related content'
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/accordion.js"></script>
  9. <%- @partial('header', { tabs: 'module' }) %>
  10. <div class="main container">
  11. <div class="ui active tab" data-tab="definition">
  12. <div class="peek">
  13. <div class="ui vertical pointing secondary menu">
  14. <a class="active item">Types</a>
  15. <a class="item">Variations</a>
  16. </div>
  17. </div>
  18. <h2 class="ui dividing header">Types</h2>
  19. <div class="example">
  20. <h4 class="ui header">Accordion</h4>
  21. <p>A standard accordion</p>
  22. <div class="ui accordion">
  23. <div class="active title">
  24. <i class="dropdown icon"></i>
  25. What is a dog?
  26. </div>
  27. <div class="active content">
  28. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  29. </div>
  30. <div class="title">
  31. <i class="dropdown icon"></i>
  32. What kinds of dogs are there?
  33. </div>
  34. <div class="content">
  35. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  36. </div>
  37. <div class="title">
  38. <i class="dropdown icon"></i>
  39. How do you acquire a dog?
  40. </div>
  41. <div class="content">
  42. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  43. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="example">
  48. <h4 class="ui header">Basic</h4>
  49. <p>A basic accordion does not add any extra formatting</p>
  50. <div class="ui basic accordion">
  51. <div class="active title">
  52. <i class="dropdown icon"></i>
  53. What is a dog?
  54. </div>
  55. <div class="active content">
  56. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  57. </div>
  58. <div class="title">
  59. <i class="dropdown icon"></i>
  60. What kinds of dogs are there?
  61. </div>
  62. <div class="content">
  63. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  64. </div>
  65. <div class="title">
  66. <i class="dropdown icon"></i>
  67. How do you acquire a dog?
  68. </div>
  69. <div class="content">
  70. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  71. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  72. </div>
  73. </div>
  74. </div>
  75. <h2 class="ui dividing header">Variations</h2>
  76. <div class="example">
  77. <h4 class="ui header">Fluid</h4>
  78. <p>An accordion can take up the width of its container</p>
  79. <div class="ui fluid accordion">
  80. <div class="active title">
  81. <i class="dropdown icon"></i>
  82. What is a dog?
  83. </div>
  84. <div class="active content">
  85. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  86. </div>
  87. <div class="title">
  88. <i class="dropdown icon"></i>
  89. What kinds of dogs are there?
  90. </div>
  91. <div class="content">
  92. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  93. </div>
  94. <div class="title">
  95. <i class="dropdown icon"></i>
  96. How do you acquire a dog?
  97. </div>
  98. <div class="content">
  99. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  100. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="ui tab" data-tab="examples">
  106. <h2 class="ui dividing header">Examples</h2>
  107. <div class="example">
  108. <h3 class="ui header">Nested</h3>
  109. <p>An accordion can have multiple levels of nested content. This content can either be in a nested <code>accordion</code> or simply another level of <code>title</code> and <code>content</code></p>
  110. <div class="ui accordion">
  111. <div class="active title">
  112. <i class="dropdown icon"></i>
  113. Level 1
  114. </div>
  115. <div class="active content">
  116. <p>Welcome to level 1 where sub content formatted as its own accordion.</p>
  117. <div class="accordion">
  118. <div class="active title">
  119. <i class="dropdown icon"></i>
  120. Level 1A
  121. </div>
  122. <div class="active content">
  123. <p>Level 1A Contents</p>
  124. <div class="accordion">
  125. <div class="title">
  126. <i class="dropdown icon"></i>
  127. Level 1A-A
  128. </div>
  129. <div class="content">
  130. Level 1A-A Contents
  131. </div>
  132. <div class="title">
  133. <i class="dropdown icon"></i>
  134. Level 1A-B
  135. </div>
  136. <div class="content">
  137. Level 1A-B Contents
  138. </div>
  139. </div>
  140. </div>
  141. <div class="title">
  142. <i class="dropdown icon"></i>
  143. Level 1B
  144. </div>
  145. <div class="content">
  146. Level 1B Contents
  147. </div>
  148. <div class="title">
  149. <i class="dropdown icon"></i>
  150. Level 1C
  151. </div>
  152. <div class="content">
  153. Level 1C Contents
  154. </div>
  155. </div>
  156. </div>
  157. <div class="title">
  158. <i class="dropdown icon"></i>
  159. Level 2
  160. </div>
  161. <div class="content">
  162. <p>Welcome to level 2 where content is formatted without nested accordions</p>
  163. <div class="active title">
  164. <i class="dropdown icon"></i>
  165. Level 2A
  166. </div>
  167. <div class="active content">
  168. <p>Level 2A Contents</p>
  169. <div class="title">
  170. <i class="dropdown icon"></i>
  171. Level 2A-A
  172. </div>
  173. <div class="content">
  174. Level 2A-A Contents
  175. </div>
  176. <div class="title">
  177. <i class="dropdown icon"></i>
  178. Level 2A-B
  179. </div>
  180. <div class="content">
  181. Level 2A-B Contents
  182. </div>
  183. </div>
  184. <div class="title">
  185. <i class="dropdown icon"></i>
  186. Level 2B
  187. </div>
  188. <div class="content">
  189. Level 2B Contents
  190. </div>
  191. <div class="title">
  192. <i class="dropdown icon"></i>
  193. Level 2C
  194. </div>
  195. <div class="content">
  196. Level 2C Contents
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. <div class="example">
  202. <h3 class="ui header">Form</h3>
  203. <p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
  204. <div class="ui segment">
  205. <div class="ui fluid form">
  206. <div class="two fields">
  207. <div class="field">
  208. <label>First Name</label>
  209. <input placeholder="First Name" type="text">
  210. </div>
  211. <div class="field">
  212. <label>Last Name</label>
  213. <input placeholder="Last Name" type="text">
  214. </div>
  215. </div>
  216. <div class="ui basic accordion field">
  217. <div class="title">
  218. <i class="icon dropdown"></i>
  219. Optional Details
  220. </div>
  221. <div class="content field">
  222. <label>Maiden Name</label>
  223. <input placeholder="Maiden Name" type="text">
  224. </div>
  225. </div>
  226. <div class="ui secondary submit button">Sign Up</div>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="example">
  231. <h3 class="ui header">Menu</h3>
  232. <p>An accordion can be used to create content drawers inside a menu</p>
  233. <div class="ui basic vertical accordion menu">
  234. <div class="item">
  235. <a class="active title">
  236. <i class="dropdown icon"></i>
  237. Size
  238. </a>
  239. <div class="active content menu">
  240. <div class="ui form item">
  241. <div class="grouped inline fields">
  242. <div class="field">
  243. <div class="ui radio checkbox">
  244. <input type="radio" name="size" value="small" />
  245. <label>Small</label>
  246. </div>
  247. </div>
  248. <div class="field">
  249. <div class="ui radio checkbox">
  250. <input type="radio" name="size" value="medium" />
  251. <label>Medium</label>
  252. </div>
  253. </div>
  254. <div class="field">
  255. <div class="ui radio checkbox">
  256. <input type="radio" name="size" value="large" />
  257. <label>Large</label>
  258. </div>
  259. </div>
  260. <div class="field">
  261. <div class="ui radio checkbox">
  262. <input type="radio" name="size" value="x-large" />
  263. <label>X-Large</label>
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. <div class="item">
  271. <a class="active title">
  272. <i class="dropdown icon"></i>
  273. Colors
  274. </a>
  275. <div class="active content menu">
  276. <div class="ui form item">
  277. <div class="grouped inline fields">
  278. <div class="field">
  279. <div class="ui checkbox">
  280. <input type="checkbox" name="small" />
  281. <label>Red</label>
  282. </div>
  283. </div>
  284. <div class="field">
  285. <div class="ui checkbox">
  286. <input type="checkbox" name="medium" />
  287. <label>Orange</label>
  288. </div>
  289. </div>
  290. <div class="field">
  291. <div class="ui checkbox">
  292. <input type="checkbox" name="large" />
  293. <label>Green</label>
  294. </div>
  295. </div>
  296. <div class="field">
  297. <div class="ui checkbox">
  298. <input type="checkbox" name="x-large" />
  299. <label>Blue</label>
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. <div class="ui tab" data-tab="usage">
  310. <h2 class="ui dividing header">Initializing</h2>
  311. <h3 class="ui header">Initializing an accordion</h3>
  312. <div class="test code">
  313. $('.ui.accordion')
  314. .accordion()
  315. ;
  316. </div>
  317. <h2 class="ui dividing header">Behaviors</h2>
  318. <p>Behaviors are accessible with javascript using the syntax:<p>
  319. <div class="code">
  320. $('.ui.accordion').accordion('behavior', argumentOne, argumentTwo...);
  321. </div>
  322. <table class="ui definition celled table segment">
  323. <tr>
  324. <td>open (index)</td>
  325. <td>Opens accordion content at index</td>
  326. </tr>
  327. <tr>
  328. <td>close (index)</td>
  329. <td>Closes accordion content at index</td>
  330. </tr>
  331. <tr>
  332. <td>toggle (index)</td>
  333. <td>Toggles accordion content at index</td>
  334. </tr>
  335. </table>
  336. </div>
  337. <div class="ui tab" data-tab="settings">
  338. <h3 class="ui header">
  339. Accordion Settings
  340. <div class="sub header">Accordion settings modify its behavior</div>
  341. </h3>
  342. <table class="ui sortable celled definition table segment">
  343. <thead>
  344. <th>Setting</th>
  345. <th class="four wide">Default</th>
  346. <th>Description</th>
  347. </thead>
  348. <tbody>
  349. <tr>
  350. <td>exclusive</td>
  351. <td>true</td>
  352. <td>Set to false to allow multiple sections to be open at the same time</td>
  353. </tr>
  354. <tr>
  355. <td>collapsible</td>
  356. <td>true</td>
  357. <td>Set to false to require an accordion to always have a section open</td>
  358. </tr>
  359. <tr>
  360. <td>duration</td>
  361. <td>500</td>
  362. <td>Duration in ms of opening animation</td>
  363. </tr>
  364. <tr>
  365. <td>easing</td>
  366. <td>easeInOutQuint</td>
  367. <td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
  368. </tr>
  369. </tbody>
  370. </table>
  371. <h3 class="ui header">
  372. Callbacks
  373. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  374. </h3>
  375. <table class="ui sortable celled definition table segment">
  376. <thead>
  377. <th class="four wide">Setting</th>
  378. <th>Context</th>
  379. <th>Description</th>
  380. </thead>
  381. <tbody>
  382. <tr>
  383. <td>onOpen</td>
  384. <td>active content</td>
  385. <td>Callback on element open</td>
  386. </tr>
  387. <tr>
  388. <td>onClose</td>
  389. <td>active content</td>
  390. <td>Callback on element close</td>
  391. </tr>
  392. <tr>
  393. <td>onChange</td>
  394. <td>active content</td>
  395. <td>Callback on element open or close</td>
  396. </tr>
  397. </tbody>
  398. </table>
  399. <h3 class="ui header">
  400. DOM Settings
  401. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  402. </h3>
  403. <table class="ui sortable celled definition table segment">
  404. <thead>
  405. <th>Setting</th>
  406. <th class="six wide">Default</th>
  407. <th>Description</th>
  408. </thead>
  409. <tbody>
  410. <tr>
  411. <td>namespace</td>
  412. <td>accordion</td>
  413. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  414. </tr>
  415. <tr>
  416. <td>selector</td>
  417. <td>
  418. <div class="code" data-type="css">
  419. {
  420. title : '.title',
  421. content : '.content'
  422. }
  423. </div>
  424. </td>
  425. <td>Object containing selectors used by module.</td>
  426. </tr>
  427. <tr>
  428. <td>className</td>
  429. <td>
  430. <div class="code">
  431. className : {
  432. active : 'active'
  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>Accordion</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. notFound : 'There were no elements that matched the specified selector'
  478. }
  479. </div>
  480. </td>
  481. </tr>
  482. </tbody>
  483. </table>
  484. </div>
  485. </div>