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.

510 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>
  202. <div class="example">
  203. <h3 class="ui header">Form</h3>
  204. <p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
  205. <div class="ui segment">
  206. <div class="ui basic fluid accordion form">
  207. <div class="two fields">
  208. <div class="field">
  209. <label>First Name</label>
  210. <input placeholder="First Name" type="text">
  211. </div>
  212. <div class="field">
  213. <label>Last Name</label>
  214. <input placeholder="Last Name" type="text">
  215. </div>
  216. </div>
  217. <div class="field">
  218. <div class="title">
  219. <i class="icon dropdown"></i>
  220. Optional Details
  221. </div>
  222. <div class="content field">
  223. <label>Maiden Name</label>
  224. <input placeholder="Maiden Name" type="text">
  225. </div>
  226. </div>
  227. <div class="ui secondary submit button">Sign Up</div>
  228. </div>
  229. </div>
  230. </div>
  231. <div class="example">
  232. <h3 class="ui header">Menu</h3>
  233. <p>An accordion can be used to create content drawers inside a menu</p>
  234. <div class="ui basic vertical accordion menu">
  235. <div class="item">
  236. <a class="active title">
  237. <i class="dropdown icon"></i>
  238. Size
  239. </a>
  240. <div class="active content menu">
  241. <div class="ui form item">
  242. <div class="grouped inline fields">
  243. <div class="field">
  244. <div class="ui radio checkbox">
  245. <input type="radio" name="size" value="small" />
  246. <label>Small</label>
  247. </div>
  248. </div>
  249. <div class="field">
  250. <div class="ui radio checkbox">
  251. <input type="radio" name="size" value="medium" />
  252. <label>Medium</label>
  253. </div>
  254. </div>
  255. <div class="field">
  256. <div class="ui radio checkbox">
  257. <input type="radio" name="size" value="large" />
  258. <label>Large</label>
  259. </div>
  260. </div>
  261. <div class="field">
  262. <div class="ui radio checkbox">
  263. <input type="radio" name="size" value="x-large" />
  264. <label>X-Large</label>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <div class="item">
  272. <a class="active title">
  273. <i class="dropdown icon"></i>
  274. Colors
  275. </a>
  276. <div class="active content menu">
  277. <div class="ui form item">
  278. <div class="grouped inline fields">
  279. <div class="field">
  280. <div class="ui checkbox">
  281. <input type="checkbox" name="small" />
  282. <label>Red</label>
  283. </div>
  284. </div>
  285. <div class="field">
  286. <div class="ui checkbox">
  287. <input type="checkbox" name="medium" />
  288. <label>Orange</label>
  289. </div>
  290. </div>
  291. <div class="field">
  292. <div class="ui checkbox">
  293. <input type="checkbox" name="large" />
  294. <label>Green</label>
  295. </div>
  296. </div>
  297. <div class="field">
  298. <div class="ui checkbox">
  299. <input type="checkbox" name="x-large" />
  300. <label>Blue</label>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. <div class="ui tab" data-tab="usage">
  311. <h2 class="ui dividing header">Initializing</h2>
  312. <h3 class="ui header">Initializing an accordion</h3>
  313. <div class="test code">
  314. $('.ui.accordion')
  315. .accordion()
  316. ;
  317. </div>
  318. <h2 class="ui dividing header">Behaviors</h2>
  319. <p>Behaviors are accessible with javascript using the syntax:<p>
  320. <div class="code">
  321. $('.ui.accordion').accordion('behavior', argumentOne, argumentTwo...);
  322. </div>
  323. <table class="ui definition celled table segment">
  324. <tr>
  325. <td>open (index)</td>
  326. <td>Opens accordion content at index</td>
  327. </tr>
  328. <tr>
  329. <td>close (index)</td>
  330. <td>Closes accordion content at index</td>
  331. </tr>
  332. <tr>
  333. <td>toggle (index)</td>
  334. <td>Toggles accordion content at index</td>
  335. </tr>
  336. </table>
  337. </div>
  338. <div class="ui tab" data-tab="settings">
  339. <h3 class="ui header">
  340. Accordion Settings
  341. <div class="sub header">Accordion settings modify its behavior</div>
  342. </h3>
  343. <table class="ui sortable celled definition table segment">
  344. <thead>
  345. <th>Setting</th>
  346. <th class="four wide">Default</th>
  347. <th>Description</th>
  348. </thead>
  349. <tbody>
  350. <tr>
  351. <td>exclusive</td>
  352. <td>true</td>
  353. <td>Set to false to allow multiple sections to be open at the same time</td>
  354. </tr>
  355. <tr>
  356. <td>collapsible</td>
  357. <td>true</td>
  358. <td>Set to false to require an accordion to always have a section open</td>
  359. </tr>
  360. <tr>
  361. <td>duration</td>
  362. <td>500</td>
  363. <td>Duration in ms of opening animation</td>
  364. </tr>
  365. <tr>
  366. <td>easing</td>
  367. <td>easeInOutQuint</td>
  368. <td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
  369. </tr>
  370. </tbody>
  371. </table>
  372. <h3 class="ui header">
  373. Callbacks
  374. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  375. </h3>
  376. <table class="ui sortable celled definition table segment">
  377. <thead>
  378. <th class="four wide">Setting</th>
  379. <th>Context</th>
  380. <th>Description</th>
  381. </thead>
  382. <tbody>
  383. <tr>
  384. <td>onOpen</td>
  385. <td>active content</td>
  386. <td>Callback on element open</td>
  387. </tr>
  388. <tr>
  389. <td>onClose</td>
  390. <td>active content</td>
  391. <td>Callback on element close</td>
  392. </tr>
  393. <tr>
  394. <td>onChange</td>
  395. <td>active content</td>
  396. <td>Callback on element open or close</td>
  397. </tr>
  398. </tbody>
  399. </table>
  400. <h3 class="ui header">
  401. DOM Settings
  402. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  403. </h3>
  404. <table class="ui sortable celled definition table segment">
  405. <thead>
  406. <th>Setting</th>
  407. <th class="six wide">Default</th>
  408. <th>Description</th>
  409. </thead>
  410. <tbody>
  411. <tr>
  412. <td>namespace</td>
  413. <td>accordion</td>
  414. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  415. </tr>
  416. <tr>
  417. <td>selector</td>
  418. <td>
  419. <div class="code" data-type="css">
  420. {
  421. title : '.title',
  422. content : '.content'
  423. }
  424. </div>
  425. </td>
  426. <td>Object containing selectors used by module.</td>
  427. </tr>
  428. <tr>
  429. <td>className</td>
  430. <td>
  431. <div class="code">
  432. className : {
  433. active : 'active'
  434. }
  435. </div>
  436. </td>
  437. <td>Class names used to attach style to state</td>
  438. </tr>
  439. </tbody>
  440. </table>
  441. <h3 class="ui header">
  442. Debug Settings
  443. <div class="sub header">Debug settings controls debug output to the console</div>
  444. </h3>
  445. <table class="ui sortable celled definition table segment">
  446. <thead>
  447. <th>Setting</th>
  448. <th class="four wide">Default</th>
  449. <th>Description</th>
  450. </thead>
  451. <tbody>
  452. <tr>
  453. <td>name</td>
  454. <td>Accordion</td>
  455. <td>Name used in debug logs</td>
  456. </tr>
  457. <tr>
  458. <td>debug</td>
  459. <td>True</td>
  460. <td>Provides standard debug output to console</td>
  461. </tr>
  462. <tr>
  463. <td>performance</td>
  464. <td>True</td>
  465. <td>Provides standard debug output to console</td>
  466. </tr>
  467. <tr>
  468. <td>verbose</td>
  469. <td>True</td>
  470. <td>Provides ancillary debug output to console</td>
  471. </tr>
  472. <tr>
  473. <td>errors</td>
  474. <td colspan="2">
  475. <div class="code">
  476. error : {
  477. method : 'The method you called is not defined.',
  478. notFound : 'There were no elements that matched the specified selector'
  479. }
  480. </div>
  481. </td>
  482. </tr>
  483. </tbody>
  484. </table>
  485. </div>
  486. </div>