手风琴 - 展开/折叠 - 但第一个面板打开并将其拧紧
我有一个手风琴,它默认打开第一个面板,方法是输入:(
$("h4#open").trigger('click');
这会触发第一个面板,就像单击了 h4 链接一样,从而打开了...)
但这似乎搞砸了唯一的方法我可以考虑展开/折叠所有面板。
我有这段代码可以展开/折叠:
$("a.ex-col").click(function(){
$("div.accordion div").slideToggle("slow");
return false;
});
使用此代码时,所有面板都会切换打开和关闭除了当时恰好打开(或关闭)的任何面板。
如何在加载时保持默认 div 打开,同时与其余部分一起展开/折叠?
谢谢。
I've got an accordion which has the first panel opened on default by throwing in:
$("h4#open").trigger('click');
(which triggers the first panel to act as if the h4 link were clicked, and thus opened...)
But this seems to screw up the only way I can think of expanding / collapsing all the panels.
I have this code to expand / collapse:
$("a.ex-col").click(function(){
$("div.accordion div").slideToggle("slow");
return false;
});
When using this, all the panels toggle open and close except any panel that happens to be open (or closed) at the time.
How can I keep the default div opened on load, while also expanding / collapsing with the rest of them?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不在加载页面时调用 SlideToggle 而不是尝试模拟单击。
Why not just call slideToggle on loading the page instead of trying to simulate a click.