I seem to experiencing a problem with the JQuery animation. I can animate the background image in the positive direction, but not in the negative direction. Any suggestions as to how to remedy this?
$(this).parent().css('background-position-y', '19px');
$(this).parent().animate({ 'background-position-y': '-=19px' }, 1000, 'linear');
Positioning the background via separate
background-position-x/yis a feature that Internet Explorer introduced but never made it into a W3C specification. Any recommendations to add it to the spec have since been denied.See:
http://snook.ca/archives/html_and_css/background-position-x-y
You can always create your own little plugin, it’s not that hard.
Using jQuery 1.8 we now have access to the $.Animation method that gives us the animated values directly without to much work, so we can do something like :
And then to use it we can do:
FIDDLE
This is something I whipped up for another answer some days ago, and only works with pixels and does have some limitations, but it’s simple and should work for most cases.
I guess something like this would do what you want: