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

132
Views
Slider need to auto slide

I have slider with right left click button and its sliding fine but not smooth sliding and I would like to auto slide my banner images with 4-5 sec duration, I have not found any tutorial how to make it auto slide, please check my script.

<script>
var slideIndex = 1;
showSlides(slideIndex);

function plusSlides(n) {
  showSlides(slideIndex += n);
}

function currentSlide(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";
}
</script>

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

0

I understand there are two questions:

  1. How can I make it smoother? That'd have to do with choosing a 'transitionable' CSS property instead of display, such as transform. See example: https://codepen.io/d88naimi/pen/YzzOQPB

  2. Auto sliding could be achieved by setting an interval at which you'd run the active slide setting function. See: https://www.w3schools.com/jsref/met_win_setinterval.asp

Hope it helps. Enjoy the process.

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!