I'm trying to animating the background-position of an element using jQuery's .animate() method. The background-position attribute is set by defining both the x and y values, like so:
background-position: 100px 100px;
Webkit now supports a background-position-x
and background-position-y
, but it is not yet supported in Firefox. If I animate only one value —
eg.
$(div).animate({'background-position':'200px'}, 1000);
— it automatically animated the X value and not the way. I can't find a way to animate the the Y value independently.
Is it a matter of getting the syntax right? Some trick with concatenation?
Note: I did get this to work in webkit using background-position-y, but would like FF support as well.