Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Image Auto slider is not working, Kindly hep me to fix the same

How can I make this slider run automatically with previous/next controls?

It's working fine when I click on the previous and next buttons, but the sliders are not running automatically. Also, when I move the cursor to any of the slides it won't pause on mouse up.

var slideIndex = 0;
showSlides(slideIndex);

// Next/previous controls
function plusSlides(n) {
  showSlides(slideIndex += n);
}

function showSlides(n) {
  var i;
  var slides = document.getElementsByClassName("mySlides");
  var dots = document.getElementsByClassName("dot");

  if (n > slides.length) {
    slideIndex = 1
  }

  if (n < 1) {
    slideIndex = slides.length
  }

  for (i = 0; i < slides.length; i++) {
    slides[i].style.display = "none";
  }

  for (i = 0; i < dots.length; i++) {
    dots[i].className = dots[i].className.replace(" active", "");
  }

  slides[slideIndex - 1].style.display = "block";
  dots[slideIndex - 1].className += " active";
  setTimeout(showSlides, 1000);
}
<div class="slideshow-container">
  <div class="mySlides fade">
    <a href="https://app.dellyranks.com/gzswVYPXlW"><img src="/imgs/hol_str_08mar.jpg" style="width:100%"></a>
  </div>
  <div class="mySlides fade">
    <a href="https://app.dellyranks.com/ePCBiHZaqU"><img src="/imgs/amz_dls_05mar.jpg" style="width:100%"></a>
  </div>
  <div class="mySlides fade">
    <a href="https://app.dellyranks.com/OfmaRDtoCl"><img src="/imgs/smr_apl_08feb.jpg" style="width:100%"></a>
  </div>
  <div class="mySlides fade">
    <a href="https://app.dellyranks.com/HAmHgVvPni"><img src="/imgs/meg_fas_08mar.jpg" style="width:100%"></a>
  </div>
  <div class="mySlides fade">
    <a href="https://app.dellyranks.com/RkOrndpUuH"><img src="/imgs/spk_str_08mar.jpg" style="width:100%"></a>
  </div>
  <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
  <a class="next" onclick="plusSlides(1)">&#10095;</a>
</div>

<div style="text-align:center;display:none">
  <span class="dot"></span>
  <span class="dot"></span>
  <span class="dot"></span>
  <span class="dot"></span>
  <span class="dot"></span>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Maybe to solve your problem, you should try to pass the "SlideIndex" Variable as parameter of the showslides function in your setTimeout.

So your setTimeout code should be

setTimeout(function(){showSlides(SlideIndex+1)},1000)

Or you could even use your plus function

setTimeout(function(){plusSlides(1)},1000)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!