[英]Jquery accordion wont stay collasped
Maybe someone having the same problem - Im having a small issue with collapse. 也许有人遇到相同的问题-我的崩溃问题很小。 I have read this article already along with a couple of others How do I keep jQuery UI Accordion collapsed by default?
我已经阅读了这篇文章以及其他一些文章, 如何默认使jQuery UI Accordion保持折叠状态? , but i can't seem to get it to collapse by default - ive managed to do it to stay open, but can't get my head around the collapsible true and active false.
,但我似乎无法默认将其折叠起来-我已经设法使其保持打开状态,但无法绕开可折叠的true和active false。 I am aiming to have it so when you click the next accordion the previous one automatically shuts.
我的目标是拥有它,因此当您单击下一个手风琴时,上一个手风琴会自动关闭。
this is the accordion js fiddle link: 这是手风琴js小提琴链接:
https://jsfiddle.net/limtu/gnhgdxrm/ https://jsfiddle.net/limtu/gnhgdxrm/
$(document).ready(function(){
$('#original .head').click(function(e){
e.preventDefault();
$(this).closest('li').find('.content').slideToggle();
});
$('#improved .head').click(function(e){
e.preventDefault();
$(this).closest('li').find('.content').not(':animated').slideToggle();
});
});
Any suggestions or links to similar problems would be really kind! 对类似问题的任何建议或链接都非常好!
Happy Friday! 星期五快乐!
$(document).ready(function(){
var $contents = $("#improved").find(".content"); // Cache your slideable elements
$('#improved .head').click(function(e){
e.preventDefault();
$contents.stop().slideUp(); // Slide up all
$(this).closest('li').find('.content').stop().slideToggle(); // Toggle one
});
});
and fix all those things in HTML and move your inline styles to stylesheet 并修复HTML中的所有内容,然后将内嵌样式移至样式表
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.