im trying to make a simple carousel slider with 3 slides with some content inside, now the problem is that i cant make to go to the first slide when im on the last one, so i would be thankful if anyone can give few pointers where im wrong.
Take a look:
http://codepen.io/anon/pen/bNpYLB enter code here
Add a slide
class to each slide. Optionally, declare slider-content[x]
as an id
(don't forget to modify the CSS accordingly):
<div class="slide" id="slider-content3">
Conduct analogical operation on the dots list:
<ul class="slider-dots"> <li class="dot active-dot">•</li> <li class="dot">•</li> <li class="dot">•</li> </ul>
And change your javascript to:
if(nextSlide.length === 0) { nextSlide = $('.slide').first(); nextDot = $('.dot').first(); }
Check on Codepen if it's the desired behaviour.
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.