我最近尝试实现我的下拉菜单,以便在单击我的按钮以从“高度:0px;”开始动画时工作 到“高度:260px;”,然而,在加载文档时,即使溢出设置为隐藏并且高度设置为 0px,div 也是可见的。
$('.DropBtn a').click(function() {
if ($(this).attr("href") == "#Open") {
$(this).attr("href", "#Close");
$('#Font-Size .DropList').stop().animate({
height: "260px",
}, 400);
} else if ($(this).attr("href") == "#Close") {
$(this).attr("href", "#Open");
$('#Font-Size .DropList').stop().animate({
height: "0px",
}, 400);
}
});
以上是我的脚本最近添加的内容,您可以在此处的 JSFiddle 上实时查看。
感谢您为解决我的问题提供的任何帮助,
最好的祝福,
蒂姆