jQuery.backgroundPosition icon indicating copy to clipboard operation
jQuery.backgroundPosition copied to clipboard

animates to pixels instead of percents

Open fxck opened this issue 12 years ago • 1 comments

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

fxck avatar Aug 23 '12 08:08 fxck

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.

Poetro avatar Aug 23 '12 09:08 Poetro