2

我有一个小问题,divoverflowed动画期间滚动闪烁。

我做了一个快速的例子:

$(".div-animate").on("click", function(e){
    var toTop = 100,
        toHeight = $(this).outerWidth(true) + toTop;

    $(this).animate({
        top: toTop,
        height: toHeight
    });
});

活生生的例子

我怎样才能防止这个小小的“滚动闪烁”?

4

2 回答 2

5

jQuery 在使用 animate 函数时添加了一个溢出:隐藏规则。您可以执行以下两种技巧:

1) 修改 jQuery 源代码中溢出设置为隐藏的行(只有从站点导入 jquery 才能执行此操作)

2)强制你的css中的属性做这样的事情

.div-animate {
     overflow: auto !important;
}
于 2012-11-26T10:55:31.113 回答
2

那么这也可以这样做:

$(this).animate({
        top: toTop,
        height: toHeight
    }).css({"overflow":"auto"});
于 2012-11-26T11:13:54.123 回答