[英]how to .animate div in jQuery, but it contains divs in that div?
My English is bad, but I'll try to explain. 我的英语不好,但我会尽力解释。 I really need, help.
我真的需要帮助 I want to make animation with div, so div height change from 0px to height 500px:
我想使用div制作动画,因此div的高度从0px更改为高度500px:
$(".link").click(function(){
$("#container").animate({height: '500'}, 1000);
});
but my problem is that div #container contains 5 more divs, and when i make this code, it doesnt work because of those 5 divs. 但我的问题是div #container包含另外5个div,当我编写此代码时,由于这5个div而无法正常工作。 When I delete those 5 divs it works.
当我删除这5个div时,它起作用了。 How to make it to work with those 5 div in that div #container.
如何使其与该div #container中的5 div一起使用。
Plese, help. 请帮忙。 Thanks.
谢谢。
HTML 的HTML
<a class="link">button</a>
<div id="container">
<div>1</div>
<div>1</div>
<div>1</div>
<div>1</div>
<div>1</div>
</div>
JS JS
$(".link").click(function () {
$("#container").animate({
height: '200'
}, 1000);
});
CSS 的CSS
#container {
height:0;
background: red;
overflow: hidden;
}
#container div {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.