An infinite carousel with vanilla JavaScript
问题 I am trying to build my own carousel with pure JavaScript. I'm struggling with picking up the most efficient way to add an infinite carousel option. For some reasons, every element (photo, generic object) must have an id The algorithm I see goes like that: You check if the carousel is overflown (the are enough objects to fit the whole container) If not: append to the back a copy of the first element, then a copy of the second element and so on. (But there will be an issue with the ids,