function changeBackground() {
var myVar = 100;
$('div.seventh').css({"background-position": myVar});
}
This is my code to make the background image move. It works but only only once… The solution I’ve tried to use to make it work more than once is this:
function changeBackground() {
var myVar = ($('div.seventh').css('backgroundPositionX'))+100;
$('div.seventh').css({"background-position": myVar});
}
Problem is that this doesn’t seem to work like I want it to work. I get the right number that I want when doing:
alert($('div.seventh').css('backgroundPositionX'));
But it just won’t work…
Any ideas?…
You can use the
animate()function: