简体   繁体   English

使用jQuery,+ =和 - = support设置css3转换属性

[英]Setting css3 transform property with jQuery, += and -= support

I'm using this jquery plugin to use CSS transforms with the jquery CSS function: 我正在使用这个jquery插件来使用带有jquery CSS函数的CSS变换:

http://www.zachstronaut.com/posts/2009/02/22/jquery-patch-css-transform.html http://www.zachstronaut.com/posts/2009/02/22/jquery-patch-css-transform.html

$('.element').css{ transform : 'translate(' + val + 'px,0)' };

The above code currently works, but I would like to be able to increment the value, like you can do, for example, with margin left: 上面的代码目前有效,但我希望能够增加值,就像你可以做的那样,例如,剩余边距:

$('.element').css{ marginLeft : '+=' + val };

Is there a way to use jquery to increment the css3 transform / translate property? 有没有办法使用jquery来增加css3 transform / translate属性?

Thanks! 谢谢!

您可以尝试添加css钩子进行translate和使用

$('.element').css({ translate : '+=' + val });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM