我有这样的jquery代码:
$(function() {
$('#butt1').click(function(){
    $('#jabe1').css("width", "300px");
    
});
});我希望#jabe1宽度在10秒内更改,而不是在点击后0秒内更改
像这样:
$('#jabe1').hide(200);它会慢慢地隐藏起来
我想让#jab1宽度变得更大,就像那张皮
jabe1 css代码:
#banners li {
    float: left;
    height: 411px;
    width: 268px;
    margin: 0px 0px 0px -50px;
    position: relative;
    background: url("../images/banner-shadow.png") no-repeat scroll center bottom transparent;
    padding: 0px;
    font-style: normal;
}发布于 2013-06-16 14:40:08
尝试使用jQuery的animate()。
Javascript代码
// Shrink the width
$('#jabe1').animate({width: '0px'}, 10000);
// Expand the width
$('#jabe1').animate({width: '300px'}, 10000);发布于 2013-06-16 14:39:51
使用动画使其变大
$("#jabe1").animate({
    width: "150%",
}, 1500 );将宽度设置为大于当前宽度,以使其展开。如果将宽度设置为小于当前宽度,它将收缩。
要了解有关动画函数的更多信息,请参见jQuery animate()。
https://stackoverflow.com/questions/17130846
复制相似问题