this is a live example of the problem: http://www.igabiba.si If you change the featured picture by clicking on the > button (next) the animation fires correctly the first time, but not on the later tries. Later on it just skips the animation and positions at the final position after the set amount of time.
Strangely enough, the animation of the previous button works flawlessly.
This is the part of the code that animates the background picture (all code is visible in the source):
if (mode == 'prev') {
$('#take_div').animate({
left: '-2000px',
}, 500, function() {
if (takeFields[2] != '') {
$('#take_link').attr('href',takeFields[2]);
}
$('#take_div').css('background',takeFields[1]+' url(/media/uploads/gTakeover/'+takeFields[0]+') no-repeat center top');
$('#take_div').css('left','');
$('#take_div').css('right','-2000px');
$('#take_div').animate({
right: '0px',
}, 500);
});
} else {
$('#take_div').animate({
right: '-=2000',
}, 500, function() {
if (takeFields[2] != '') {
$('#take_link').attr('href',takeFields[2]);
}
$('#take_div').css('background',takeFields[1]+' url(/media/uploads/gTakeover/'+takeFields[0]+') no-repeat center top');
$('#take_div').css('right','');
$('#take_div').css('left','-2000px');
$('#take_div').animate({
left: '0px',
}, 500);
});
}
I would appreciate some help with this.