我想切换一个分区的高度。我尝试将.animate与if / else语句一起使用。但它只会反弹。我现在使用的代码将隐藏我的部门而不是切换高度。单击时将触发。
$(document).ready(function() {
$("#content1").toggle(function(){
$(this).animate({height:'400px'});
}, function() {
$(this).animate({height:'200px'});
});
});
Run Code Online (Sandbox Code Playgroud)
我希望有人能找到答案,因为我无法在google / stackoverflow上找到答案。