我試圖讓我的手風琴摺疊點擊下一個標籤,我有問題。我相信代碼是正確的,標籤打開。但如果我點擊標籤2選項卡1仍然打開。jquery手風琴摺疊新標籤打開
如果選項卡打開,箭頭也不會朝下。
HTML
<ul class="aside-nav d-all grey-border ">
<li class="aside-open-close active">
<a class="aside-opener" href="#">tab1</a>
<div class="slide">
content
</div>
</li>
<li class="aside-open-close ">
<a class="aside-opener" href="#">tab2</a>
<div class="slide">
content
</div>
</li>
<li class="aside-open-close ">
<a class="aside-opener" href="#">tab3</a>
<div class="slide">
content
</div>
</li>
</ul>
JQUERY
// open-close init
function initOpenClose() {
jQuery('.open-close, .aside-open-close').openClose({
activeClass: 'active',
opener: '.opener, .aside-opener',
slider: '.slide',
animSpeed: 400,
effect: 'slide'
});
jQuery('.nav').openClose({
activeClass: 'active',
opener: '.nav-opener',
slider: '.nav-slide',
animSpeed: 400,
effect: 'slide'
});
jQuery('#nav .drop').each(function(){
var holder = jQuery(this);
var opener = holder.children('a');
var drop = holder.children('.drop-holder');
opener.on('click', function(e){
e.preventDefault();
holder.toggleClass('hover');
});
jQuery('body').on('click', function(e){
if(holder.hasClass('hover') && !jQuery(e.target).closest(holder).length) holder.removeClass('hover')
});
});
}
你在哪裏設置手風琴?你錯過了代碼部分 – Luca