折叠框Accordion

折叠框 Accordion - 图1

  1. <ul class="accordion">
  2. <li>
  3. <div class="title">Clothing</div>
  4. <div class="content">
  5. <p>Content A</p>
  6. </div>
  7. </li>
  8. <li>
  9. <div class="title">Accessories</div>
  10. <div class="content">
  11. <p>Content B</p>
  12. </div>
  13. </li>
  14. <li>
  15. <div class="title">Electronics</div>
  16. <div class="content">
  17. <p>Content C</p>
  18. </div>
  19. </li>
  20. </ul>

激活与禁用Active and Disabled

为<li>元素添加class="active"使其默认是展开的,添加class="disabled"转换为禁用项

折叠框 Accordion - 图2

  1. <ul class="accordion">
  2. <li>
  3. <div class="title">Clothing</div>
  4. <div class="content">
  5. <p>Content A</p>
  6. </div>
  7. </li>
  8. <li class="active">
  9. <div class="title">Accessories</div>
  10. <div class="content">
  11. <p>Content B</p>
  12. </div>
  13. </li>
  14. <li class="disabled">
  15. <div class="title">Electronics</div>
  16. <div class="content">
  17. <p>Content C</p>
  18. </div>
  19. </li>
  20. </ul>

移动选项Move Item

在内容项中添加data-move-item属性的元素会触发移动至设定项

折叠框 Accordion - 图3

  1. <ul class="accordion">
  2. <li class="active">
  3. <div class="title">Clothing</div>
  4. <div class="content">
  5. <p>Content A</p>
  6. <button type="button" class="btn xs" data-move-item="first">First</button>
  7. <button type="button" class="btn xs" data-move-item="prev">Prev</button>
  8. <button type="button" class="btn xs" data-move-item="next">Next</button>
  9. <button type="button" class="btn xs" data-move-item="last">Last</button>
  10. </div>
  11. </li>
  12. <li>
  13. <div class="title">Accessories</div>
  14. <div class="content">
  15. <p>Content B</p>
  16. <button type="button" class="btn xs" data-move-item="first">First</button>
  17. <button type="button" class="btn xs" data-move-item="prev">Prev</button>
  18. <button type="button" class="btn xs" data-move-item="next">Next</button>
  19. <button type="button" class="btn xs" data-move-item="last">Last</button>
  20. </div>
  21. </li>
  22. <li>
  23. <div class="title">Electronics</div>
  24. <div class="content">
  25. <p>Content C</p>
  26. <button type="button" class="btn xs" data-move-item="first">First</button>
  27. <button type="button" class="btn xs" data-move-item="prev">Prev</button>
  28. <button type="button" class="btn xs" data-move-item="next">Next</button>
  29. <button type="button" class="btn xs" data-move-item="last">Last</button>
  30. </div>
  31. </li>
  32. </ul>

自定义风格Custom Style

可以使用自定义风格工具快速创建CSS

折叠框 Accordion - 图4

  1. <ul class="accordion mystyle">
  2. ...
  3. </ul>