如何使用相同的方法jQuery scrollTop与css3 [英] how to use the same method of jquery scrollTop with css3
本文介绍了如何使用相同的方法jQuery scrollTop与css3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要相同的效果scrollTop的jquery,但我不会使用它。
因为在某些平板电脑这会产生问题(它不能与GPU工作)。
I want the same effect scrollTop of jquery, but i wan't use it. Because in some tablet this create problems (it not work with GPU).
推荐答案
在 transform
属性上转换,然后在转换后清除变换并设置 scrollTop
。这似乎很好。
I recently solved this problem by transitioning on the transform
property, then after the transition clearing the transform and setting scrollTop
. That seems to work well.
document.body.style.webkitTransitionDuration="500ms";
document.body.style.webkitTransform="translate("+(left()-x)+"px,"+(top()-y)+"px)";
window.setTimeout(function(){
document.body.style.webkitTransitionDuration="0ms";
window.scrollTo(x,y);
},500);
和
body {
-webkit-transition: -webkit-transform 1.8s ease-in-out;
}
这篇关于如何使用相同的方法jQuery scrollTop与css3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文