Skip to main content

Bug Tracker

Side navigation

#7448 closed bug (invalid)

Opened November 09, 2010 02:13PM UTC

Closed November 09, 2010 08:09PM UTC

Last modified March 13, 2012 07:02PM UTC

'animate' doesn't work for 'background-position' property in IE6-7

Reported by: private.face@gmail.com Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

Since I switched to jquery-1.4.3 the following code stopped working in IE6-7:

   $('#a').animate({
       'background-position' : '200px 0'
   });

Now it causes the following error:

Invalid argument. jquery.js line 6573 character 5:
    fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;

At the same time, animation for properties 'background-position-x' and 'background-position-y' seems to be working fine.

Attachments (0)
Change History (3)

Changed November 09, 2010 02:54PM UTC by jitter comment:1

_comment0: The documentation for [http://api.jquery.com/animate/ animate] states \ >Shorthand CSS properties (e.g. margin, background, border) are not supported. \ \ Shorthand properties don't work equally across all browsers. For animating background-position in a cross browser way consider using the `bgpos`-cssHook from [https://github.com/brandonaaron/jquery-cssHooks/ jquery-cssHooks]1289315342018520

The documentation for animate states

>Shorthand CSS properties (e.g. margin, background, border) are not supported.

Changed November 09, 2010 03:51PM UTC by private.face@gmail.com comment:2

I'm not sure that 'background-position' is a shorthand property, but I found another condition that I missed:

All animated properties should be a ''single numeric value''

Changed November 09, 2010 08:09PM UTC by snover comment:3

resolution: → invalid
status: newclosed

Thanks for the report, but this is not a jQuery bug. If you want to animate background position, you need to install a plugin that adds support for it.