[英]Jquery Accordion first panel auto opened
Can i set first panel on Jquery automatically opened? 我可以在自动打开的Jquery上设置第一个面板吗? My accordion panel is close all.
我的手风琴面板关闭了。
This is my html 这是我的HTML
<div class="accordionx">
<div class="acitemx">
<h3>First Panel</h3>
<div class="accx">
This is the content
</div>
</div>
<div class="acitemx">
<h3>Second Panel</h3>
<div class="accx">
This is the content
</div>
</div>
<div class="acitemx">
<h3>Third Panel</h3>
<div class="accx">
This is the content
</div>
</div>
This is my JS script 这是我的JS脚本
$(".acitemx h3").click(function () {
$header = $(this);
$content = $header.next();
$content.slideToggle(500, function () {
$(this).parent().toggleClass('current');
});
}); });
This the JSFiddle Link http://jsfiddle.net/bupd32rq/ 这是JSFiddle链接http://jsfiddle.net/bupd32rq/
Thanks for your help 谢谢你的帮助
Panels that opened were added with current
class, then put class current
manually on first panel and respective div with style="display:block"
: 打开的面板添加有
current
类,然后将current
类手动放置在第一个面板上,并使用style="display:block"
分别放在div上:
<div class="acitemx current">
<h3>First Panel</h3>
<div class="accx" style="display:block">
This is the content
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.