How to make loop so that after the last testimonial /li/ the whole ul will repeat again (so after the last slide there will be first slide again)?
This is my jsFiddle: https://jsfiddle.net/t2zwo0fr/14/
This is the function which does interval, I want to enhance it with loop so that after the last testimonial /li/ there whole ul will repeat:
function blink() {
if (active || slideIndex >= slideCount - 1) {
return;
}
slideIndex++;
active = true;
$('ul').animate(
{'left': $('ul').position().left-szer1slidu},
3000,
function() {
{ active = false; }
}
);
}
setInterval(blink,1000);
Well, when the animation reaches the third li
, I would use appendChild to move the first li
to the last position and every time the "previous" animation is called, I'd insertBefore the other way around.. but that's without jQuery. :p
Also, don't forget to update the position of the ul
to still show the current li
.
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.