Background-position is a dual property, containing both the X and Y
coordinates. To animate it, you have to animate the X and Y separately.
$('#header').animate({backgroundPositionX : bkgPosX , backgroundPositionY:
bkgPosY },'slow');
JK
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of sspboyd
Sent: Thursday, April 19, 2007 2:35 PM
To: jQuery (English)
Subject: [jQuery] animate background-position??
Hi,
I've been trying several ways to animate the position of a background
image and I'm stuck.
This is the code I'm using:
$("#header").click(function(){
var bkgPosX=Math.round(Math.random()*(-500));
var bkgPosY=Math.round(Math.random()*(-200));
$("#header").animate({style: 'background-position: bkgPosX
bkgPosY;'},'slow');
});
Any help is much appreciated!
Steve