Animation moving from left to right js problem

so I have an animation which moves from left to right

        interval2X = setInterval(function(){
        $('.carousel')
            .css('left', '')
            .animate({ left: '-=' + offset }, 2000, 'linear');
    }, 1000);

That div coursel contains square boxes like.

<div class="carousel-item item1"> <div class="carousel-image" style="background-image: url("/image/item1.jpg");"></div>  <div class="carousel-item item2"> <div class="carousel-image" style="background-image: url("/image/item2.jpg");"></div>

and so go on, there are 100 items like that.

When this animation is completed (it goes over item 100) I want it to go all over again (same carousel-items, just like loop).

It looks like that carousel so I would want this loop to be as smooth as possible.

I have no idea how to really achieve that.



Read more here: https://stackoverflow.com/questions/64397873/animation-moving-from-left-to-right-js-problem

Content Attribution

This content was originally published by grind955 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: