$(function() {
$("table.section thead").click(function() {
if ($(this).next("table.section tbody").style.display == "block"){
$(this).next("table.section tbody").slideUp("slow");
}
if ($(this).next("table.section tbody").style.display == "none"){
$(this).next("table.section tbody").slideDown("slow");
}
});
});
我不知道如何实现这一点,任何帮助将不胜感激。
更新:
我试图使用以下功能。
$(function() {
$("table.section thead").click(function() {
$(this).next("table.section tbody").slideToggle("slow");
});
});
这给了我一个问题,(当它折叠并单击它时,它会展开然后再次折叠,所以它总是会折叠)。这就是为什么我试图将功能置于顶部。