[英]Difference between x, y, left, right with CSS
I have something that looks like this, which doesn't apply the x or y transform but does apply rotation. 我有一个看起来像这样的东西,它不应用x或y变换,但是应用旋转。
$('<div/>').css(
"-webkit-transform": "rotate(20deg)"
x: 10
y: 10
)
This applies the x
and y
but not the rotation: 这将应用
x
和y
但不会应用旋转:
$('<div/>').css(
"-webkit-transform": "rotate(20deg)"
x: 10
y: 10
)
If I do it with left
and right
it works 如果我
left
right
都可以
$('<div/>').css(
"-webkit-transform": "rotate(20deg)"
left: 10
right: 10
)
PS: I'm using coffeescript PS:我正在使用coffeescript
If you're asking why left
and right
work but x
and y
don't, it's because you're using .css()
which is ultimately setting CSS and there is no x
or y
CSS properties. 如果您要问为什么
left
right
而x
和y
对不对,那是因为您使用的.css()
最终会设置CSS,并且没有x
或y
CSS属性。
You're probably looking for translate()
: 您可能正在寻找
translate()
:
-webkit-transform: translate(50px,100px);
You can add css object as below, 您可以如下添加css对象,
$('<div/>').css({
"-webkit-transform": "rotate(20deg)"
x: 10
y: 10
});
there is one jQuery plugin that do css animation. 有一个做CSS动画的jQuery插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.