【发布时间】:2016-09-19 22:27:53
【问题描述】:
我遇到了一个无法解决的 jQuery 问题。 我创建了一个带有子菜单元素的菜单。我想通过单击菜单项来切换内容的高度。问题是当我单击其他项目时,内容会崩溃。有点难以解释,我已经让两个网站完成这项工作 http://www.polerstuff.com/ -> 当您点击“商店”然后点击“信息”时,子菜单保持打开状态。在这里看到了同样的技巧http://topodesigns.com/
我猜这两个网站都在使用 Shopify。
$(document).ready(function() {
$(".button").on("click", function() {
if($(".content").height() == 0) {
$(".content").animate({height: "300px"});
}
else if($(".content").height() == 300) {
$(".content").animate({height: "0px"});
}
});
});
这是我的jsfiddle -> 提前非常感谢。
【问题讨论】:
标签: javascript jquery html shopify