无法在Foundation 5中使用手风琴

时间:2019-05-27 12:36:54

标签: jquery zurb-foundation zurb-foundation-5

我正在尝试在Foundation 5中使用手风琴,但是仍然无法正常工作。谁能指导我哪里做错了

<!DOCTYPE html>
<html>
  <head>
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.4.7/css/foundation.min.css">
     <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/5.4.7/js/vendor/jquery.js">
     </script>
     <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/5.4.7/js/foundation.min.js">
     </script>
     <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/5.4.7/js/foundation/foundation.accordion.js">
     </script>

     <script>
    $(document).foundation({
      accordion: {
        callback : function (accordion) {
          console.log(accordion);
        }
      }
    });
  </script>
</head>

<body>

<ul class="small-block-grid-1 medium-block-grid-3">
        <li>
          <ul class="accordion" data-accordion="myAccordionGroup">
            <li class="accordion-navigation">
              <a href="#panel1c">Accordion 1</a>
              <div id="panel1c" class="content">
                Panel 1. Lorem ipsum dolor
              </div>
            </li>
            <li class="accordion-navigation">
              <a href="#panel2c">Accordion 2</a>
              <div id="panel2c" class="content">
                Panel 2. Lorem ipsum dolor
              </div>
            </li>
            <li class="accordion-navigation">
              <a href="#panel3c">Accordion 3</a>
              <div id="panel3c" class="content">
                Panel 3. Lorem ipsum dolor
              </div>
            </li>
          </ul>
        </li>        
</ul>

</body>

</html>

版本

Foundation.js-5.4.7
Foundation.css-5.4.7
foundation.accordion.js-5.4.7
jQuery-2.1.1

1 个答案:

答案 0 :(得分:0)

我发现基于Foundation 5.4.7的解决方案不支持带有ul&li标签的手风琴。它支持5.5及更高版本

https://foundation.zurb.com/sites/docs/v/5.5.3/components/accordion.html

要使用手风琴,我需要使用dl&dd标签