如何使用 jquery 制作一个向上滑动的水平 DIV 容器?到目前为止,我有下面提供的代码。问题是 <h1 id="filter_content">Content</h1>
的内容最初没有隐藏。我还看到非常漂亮的向上滑动菜单,类似于第一个屏幕截图 here .因此,当用户点击 + 时,内容会向上滑动。我在哪里可以找到示例代码或一些示例?
<div id="filter">
<h1>Filter</h1><br>
</div>
<h1 id="filter_content">Content</h1>
<script>
$('#filter').click(function() {
if ($("#filter").is(":hidden")) {
$("#filter_content").show("slow");
} else {
$("#filter_content").slideUp("slow");
}
});
</script>
最佳答案
嗨 working demo click here 或 Initially hidden demo here
使用 slideToggle
API:好读 http://api.jquery.com/slideToggle/将为您正在寻找的确切行为做一些技巧。
代码
$('#filter').click(function() {
$("#filter_content").slideToggle("slow");
});
关于php - 向上滑动 DIV 容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10684857/