简体   繁体   中英

Slide Carousel without Manipulating DOM using jQuery

I am working on my custom carousel slider and I want to make it slide left/right infinitely. When I click on next button, it should slide toward left. Right now when I reach to the last item and next button is pressed, I take the first item and append that to the last before sliding left.

$(".carousel-inner").find("div:last").after($(".carousel-inner").find("div:first"));

I am supposed to do it without changing DOM . Is there any good logic to loop infinitely?

Use bootstrap. It's quite easy to use and won't manipulate the DOM. Moreover, basic functionality doesn't even require you to write any javascript. Example of how to use is here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM