使用javascript或jquery更改div元素的高度,但必须缓慢更改 [英] Changing height of a div element using javascript or jquery but it must change slowly
本文介绍了使用javascript或jquery更改div元素的高度,但必须缓慢更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在div元素中设置了背景,当我点击锚标签时,我想增加该div标签的高度.但是我希望高度缓慢增加.
Hi I have set a background in a div element and i want to increase the height of that div tag when I click on an anchor tag. But i want the height to be increased slowly.
推荐答案
您可以更改动画的duration
:
$('#element').animate({
height: '200px'
}, {
duration: 2000 // 2 seconds
});
演示: http://jsfiddle.net/t5VYa/
Demo: http://jsfiddle.net/t5VYa/
这篇关于使用javascript或jquery更改div元素的高度,但必须缓慢更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文