CSS3性能?动画left或translateX [英] CSS3 performance? animate left or translateX

查看:182
本文介绍了CSS3性能?动画left或translateX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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.

http://jsfiddle.net/MZBtr/2/

您可以使用 Mondernizr 进行特征检测,然后根据结果决定要做什么。

You could use Mondernizr for feature detection and then decide what to do according to the result.


http://jsfiddle.net/zWavD/1/

这篇关于CSS3性能?动画left或translateX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆