gpt4 book ai didi

Jquery Accordion 菜单主动打开

转载 作者:太空宇宙 更新时间:2023-11-03 18:09:31 26 4
gpt4 key购买 nike

我有一个可用的 jquery Accordion 菜单。有一件事仍然不会成功。当我打开菜单并单击链接时,菜单会再次关闭。我希望菜单保持打开状态,并且仅在另一个菜单打开时关闭。

对不起我的英语。J查询代码

$(document).ready(function(){
$('.item').click(function(){
if($(this).css('max-height') == '37px') {
$(this).css('max-height','240px')
}else {
$(this).css('max-height','37px')
}
});
});

我希望有人能帮助我。

这是一个用于 html 和 css 的 jsfiddle:http://jsfiddle.net/aAn8n/

最佳答案

试试这个

$('.kop').click(function(){
var $parent = $(this).parent(".item");

if($parent.css('max-height') == '24px') {
$(".item").css('max-height','24px');
$parent.css('max-height','240px');
}else {
$parent.css('max-height','24px');
}
});

工作 DEMO

关于Jquery Accordion 菜单主动打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24009823/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com