jQuery.backgroundPosition
jQuery.backgroundPosition copied to clipboard
animates to pixels instead of percents
result of this
$("#logo").animate({
backgroundPositionY: '0%',
backgroundPositionX: '50%'
});
is this
<a id="logo" href="#" style="background-position: 50px 0px;"></a>
need a fiddle?
using jquery 1.8.0
The issue is, that jQuery uses px values for everything, and converts everything to pixels. So it cannot animate percentages. You have to convert the percentage values to pixels before animating.