jquery animate隐藏滚动

Ric*_*nns 2 javascript jquery overflow jquery-animate

我有一个小问题animeting一个div就是overflowed动画过程中,滚动闪烁.

我做了一个快速的例子:

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

    $(this).animate({
        top: toTop,
        height: toHeight
    });
});
Run Code Online (Sandbox Code Playgroud)

实例

我怎么能防止这个小小的'滚动眨眼'?

Ste*_*isi 5

jQuery在使用animate函数时添加了overflow:hidden规则.你可以做两件黑客:

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

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

.div-animate {
     overflow: auto !important;
}
Run Code Online (Sandbox Code Playgroud)