1
I am creating an infinite Carousel that should be excited between transitions, however the event .animate()
only works in the first transition, the rest is completely static, without animation.
Code:
var next = function(){
var left = parseInt(ul.css('left')) - (size + rest + settings.margin);
ul.stop(true, true).animate({'left' : left}, settings.speed, function(){
$('> li:last', ul).after($('> li:first', ul));
ul.css({'left' : (size + rest + settings.margin) * (-1)});
});
return false;
}
var transition = null;
var init = function(){
transition = setInterval(function(){
next();
}, settings.delay)
};
init();
Note: if I remove the fix .css()
from the position, Carousel stays excited, but logically ul will be going left until it disappears.
What’s wrong with it?
Can you recreate the problem in jsFiddle? There are many variables in the code above that you can’t see where they come from. It’s hard to know what the code does like this.
– Sergio