$(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"
})