[英]jquery animate hide the scroll
我有一个小问题,动画一个overflowed
的div
,动画期间滚动闪烁。
我做了一个快速的例子:
$(".div-animate").on("click", function(e){
var toTop = 100,
toHeight = $(this).outerWidth(true) + toTop;
$(this).animate({
top: toTop,
height: toHeight
});
});
我怎么能防止这个小小的'滚动眨眼'?
jQuery在使用animate函数时添加了overflow:hidden规则。 您可以执行两种操作:
1)修改jQuery源代码行,其中将溢出设置为隐藏(仅当您从网站导入jquery时才能执行此操作)
2)强制你的css中的属性做这样的事情
.div-animate {
overflow: auto !important;
}
那么这也可以这样做:
$(this).animate({
top: toTop,
height: toHeight
}).css({"overflow":"auto"});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.