有没有更好的方法来为这个accordian构建这个jquery?
我知道你可以使用jqueryaccordio函数来实现这一点,但我正在尝试另一种方法 你可以看到我在这里拼凑的代码 有没有更好的方法来构造jquery有没有更好的方法来为这个accordian构建这个jquery?,jquery,css,performance,Jquery,Css,Performance,我知道你可以使用jqueryaccordio函数来实现这一点,但我正在尝试另一种方法 你可以看到我在这里拼凑的代码 有没有更好的方法来构造jquery $('.acchead').click(function(){ //check if already open othwerwise... if (!$(this).next().hasClass("sel")){ //remove the initially opened item if($(this).next().
$('.acchead').click(function(){
//check if already open othwerwise...
if (!$(this).next().hasClass("sel")){
//remove the initially opened item
if($(this).next().hasClass("init")){
$(this).next().removeClass('init');
}
//close all items, remove any selected classes, open clicked item
$('.sel').slideUp();
$('.acc .sel').removeClass('sel');
$(this).next().slideDown().addClass('sel');
}
});
干杯您最好将问题提交给:您可以避免对所有元素进行分解。您可以使用标题、段落和分段元素,还可以定义一个名为is_busy的变量,通过该变量,您可以确定是否存在活动的动画,然后阻止新动画执行或将其放在一行中。那会使你的工作做得更好。你知道如果你快速点击一些标题,你就不会等到动画结束。