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.

414 lines
14 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">Form</h3>
  109. <p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
  110. <div class="ui segment">
  111. <div class="ui basic fluid accordion form">
  112. <div class="two fields">
  113. <div class="field">
  114. <label>First Name</label>
  115. <input placeholder="First Name" type="text">
  116. </div>
  117. <div class="field">
  118. <label>Last Name</label>
  119. <input placeholder="Last Name" type="text">
  120. </div>
  121. </div>
  122. <div class="field">
  123. <div class="title">
  124. <i class="icon dropdown"></i>
  125. Optional Details
  126. </div>
  127. <div class="content field">
  128. <label>Maiden Name</label>
  129. <input placeholder="Maiden Name" type="text">
  130. </div>
  131. </div>
  132. <div class="ui secondary submit button">Sign Up</div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="example">
  137. <h3 class="ui header">Menu</h3>
  138. <p>An accordion can be used to create content drawers inside a menu</p>
  139. <div class="ui basic vertical accordion menu">
  140. <div class="item">
  141. <a class="active title">
  142. <i class="dropdown icon"></i>
  143. Size
  144. </a>
  145. <div class="active content menu">
  146. <div class="ui form item">
  147. <div class="grouped inline fields">
  148. <div class="field">
  149. <div class="ui radio checkbox">
  150. <input type="radio" name="size" value="small" />
  151. <label>Small</label>
  152. </div>
  153. </div>
  154. <div class="field">
  155. <div class="ui radio checkbox">
  156. <input type="radio" name="size" value="medium" />
  157. <label>Medium</label>
  158. </div>
  159. </div>
  160. <div class="field">
  161. <div class="ui radio checkbox">
  162. <input type="radio" name="size" value="large" />
  163. <label>Large</label>
  164. </div>
  165. </div>
  166. <div class="field">
  167. <div class="ui radio checkbox">
  168. <input type="radio" name="size" value="x-large" />
  169. <label>X-Large</label>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="item">
  177. <a class="active title">
  178. <i class="dropdown icon"></i>
  179. Colors
  180. </a>
  181. <div class="active content menu">
  182. <div class="ui form item">
  183. <div class="grouped inline fields">
  184. <div class="field">
  185. <div class="ui checkbox">
  186. <input type="checkbox" name="small" />
  187. <label>Red</label>
  188. </div>
  189. </div>
  190. <div class="field">
  191. <div class="ui checkbox">
  192. <input type="checkbox" name="medium" />
  193. <label>Orange</label>
  194. </div>
  195. </div>
  196. <div class="field">
  197. <div class="ui checkbox">
  198. <input type="checkbox" name="large" />
  199. <label>Green</label>
  200. </div>
  201. </div>
  202. <div class="field">
  203. <div class="ui checkbox">
  204. <input type="checkbox" name="x-large" />
  205. <label>Blue</label>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="ui tab" data-tab="usage">
  216. <h2 class="ui dividing header">Initializing</h2>
  217. <h3 class="ui header">Initializing an accordion</h3>
  218. <div class="test code">
  219. $('.ui.accordion')
  220. .accordion()
  221. ;
  222. </div>
  223. <h2 class="ui dividing header">Behaviors</h2>
  224. <p>Behaviors are accessible with javascript using the syntax:<p>
  225. <div class="code">
  226. $('.ui.accordion').accordion('behavior', argumentOne, argumentTwo...);
  227. </div>
  228. <table class="ui definition celled table segment">
  229. <tr>
  230. <td>open (index)</td>
  231. <td>Opens accordion content at index</td>
  232. </tr>
  233. <tr>
  234. <td>close (index)</td>
  235. <td>Closes accordion content at index</td>
  236. </tr>
  237. <tr>
  238. <td>toggle (index)</td>
  239. <td>Toggles accordion content at index</td>
  240. </tr>
  241. </table>
  242. </div>
  243. <div class="ui tab" data-tab="settings">
  244. <h3 class="ui header">
  245. Accordion Settings
  246. <div class="sub header">Accordion settings modify its behavior</div>
  247. </h3>
  248. <table class="ui sortable celled definition table segment">
  249. <thead>
  250. <th>Setting</th>
  251. <th class="four wide">Default</th>
  252. <th>Description</th>
  253. </thead>
  254. <tbody>
  255. <tr>
  256. <td>exclusive</td>
  257. <td>true</td>
  258. <td>Set to false to allow multiple sections to be open at the same time</td>
  259. </tr>
  260. <tr>
  261. <td>collapsible</td>
  262. <td>true</td>
  263. <td>Set to false to require an accordion to always have a section open</td>
  264. </tr>
  265. <tr>
  266. <td>duration</td>
  267. <td>500</td>
  268. <td>Duration in ms of opening animation</td>
  269. </tr>
  270. <tr>
  271. <td>easing</td>
  272. <td>easeInOutQuint</td>
  273. <td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. <h3 class="ui header">
  278. Callbacks
  279. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  280. </h3>
  281. <table class="ui sortable celled definition table segment">
  282. <thead>
  283. <th class="four wide">Setting</th>
  284. <th>Context</th>
  285. <th>Description</th>
  286. </thead>
  287. <tbody>
  288. <tr>
  289. <td>onOpen</td>
  290. <td>active content</td>
  291. <td>Callback on element open</td>
  292. </tr>
  293. <tr>
  294. <td>onClose</td>
  295. <td>active content</td>
  296. <td>Callback on element close</td>
  297. </tr>
  298. <tr>
  299. <td>onChange</td>
  300. <td>active content</td>
  301. <td>Callback on element open or close</td>
  302. </tr>
  303. </tbody>
  304. </table>
  305. <h3 class="ui header">
  306. DOM Settings
  307. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  308. </h3>
  309. <table class="ui sortable celled definition table segment">
  310. <thead>
  311. <th>Setting</th>
  312. <th class="six wide">Default</th>
  313. <th>Description</th>
  314. </thead>
  315. <tbody>
  316. <tr>
  317. <td>namespace</td>
  318. <td>accordion</td>
  319. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  320. </tr>
  321. <tr>
  322. <td>selector</td>
  323. <td>
  324. <div class="code" data-type="css">
  325. {
  326. title : '.title',
  327. content : '.content'
  328. }
  329. </div>
  330. </td>
  331. <td>Object containing selectors used by module.</td>
  332. </tr>
  333. <tr>
  334. <td>className</td>
  335. <td>
  336. <div class="code">
  337. className : {
  338. active : 'active'
  339. }
  340. </div>
  341. </td>
  342. <td>Class names used to attach style to state</td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <h3 class="ui header">
  347. Debug Settings
  348. <div class="sub header">Debug settings controls debug output to the console</div>
  349. </h3>
  350. <table class="ui sortable celled definition table segment">
  351. <thead>
  352. <th>Setting</th>
  353. <th class="four wide">Default</th>
  354. <th>Description</th>
  355. </thead>
  356. <tbody>
  357. <tr>
  358. <td>name</td>
  359. <td>Accordion</td>
  360. <td>Name used in debug logs</td>
  361. </tr>
  362. <tr>
  363. <td>debug</td>
  364. <td>True</td>
  365. <td>Provides standard debug output to console</td>
  366. </tr>
  367. <tr>
  368. <td>performance</td>
  369. <td>True</td>
  370. <td>Provides standard debug output to console</td>
  371. </tr>
  372. <tr>
  373. <td>verbose</td>
  374. <td>True</td>
  375. <td>Provides ancillary debug output to console</td>
  376. </tr>
  377. <tr>
  378. <td>errors</td>
  379. <td colspan="2">
  380. <div class="code">
  381. error : {
  382. method : 'The method you called is not defined.',
  383. notFound : 'There were no elements that matched the specified selector'
  384. }
  385. </div>
  386. </td>
  387. </tr>
  388. </tbody>
  389. </table>
  390. </div>
  391. </div>