jQuery UI - Accordion - 悬停在活动项目上

时间:2018-03-15 20:58:01

标签: javascript jquery css jquery-ui

  $(document).ready(function(){
    $("#accordion").accordion({
        // heightStyle: "fill",
        collapsible: true,
        active: 0,
        animate: "swing",
        event: "mouseenter"
    })
    .on('mouseleave', function () {
         $(this).accordion("option", "active", false);
     });

  });
<div id="accordion">
  <h3>First header</h3>
  <div>First content panel</div>
  <h3>Second header</h3>
  <div>Second content panel</div>
</div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>

我正在使用手风琴的jQuery UI,如果我将鼠标悬停在“标题”上,则会显示内容。

当我悬停已经“有效”项时,此问题将被取消激活。这是PEN

JS:

$("nav").accordion({
    collapsible: true,
    active: 0,
    animate: "swing",
    event: "mouseenter"
})

0 个答案:

没有答案