问题描述
在HTML5 / CSS3演示中,我使用CSS转换主要是为了加快性能。
In a HTML5 / CSS3 Demo I am making, Im using CSS transitions mostly to speed up the performance.
我想知道我的UI - 基于鼠标位置的容器Div的LEFT属性,例如,我应该改用 transform:translateX(tx)
吗?或者JQuery是否会在浏览器支持它时自动执行此操作?
I was wondering for my UI - where currently JQuery manipulates the LEFT attribute of a container Div based on mouse position for example, should I instead use transform: translateX(tx)
instead? or does JQuery do this automatically if the browser supports it?
推荐答案
jquery不使用transform:translateX(tx)
你必须手动做。但它是一个很好的做法,因为它实际上要快得多。
jquery does not use transform: translateX(tx) instead.You have to do it manualy. But its a good practice to do this, because its actually much faster.
您可以使用进行特征检测,然后根据结果决定要做什么。
You could use Mondernizr for feature detection and then decide what to do according to the result.
:
这篇关于CSS3性能?动画left或translateX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!