How to create sliders for my website using java script?


Can some one help me to create sliders using java script?


Yeah. Use this. It’s great.

If you have any problem with the configuration, just let us know.


Already @James_Hibbard show you a best example. But if you want any other the you can try this one.

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">

<h2 class="w3-center">Manual Slideshow</h2>

<div class="w3-content w3-display-container">
  <img class="mySlides" src="img_fjords.jpg" style="width:100%">
  <img class="mySlides" src="img_lights.jpg" style="width:100%">
  <img class="mySlides" src="img_mountains.jpg" style="width:100%">
  <img class="mySlides" src="img_forest.jpg" style="width:100%">

  <button class="w3-button w3-black w3-display-left" onclick="plusDivs(-1)">&#10094;</button>
  <button class="w3-button w3-black w3-display-right" onclick="plusDivs(1)">&#10095;</button>

var slideIndex = 1;

function plusDivs(n) {
  showDivs(slideIndex += n);

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  if (n > x.length) {slideIndex = 1}    
  if (n < 1) {slideIndex = x.length}
  for (i = 0; i < x.length; i++) {
     x[i].style.display = "none";  
  x[slideIndex-1].style.display = "block";  


Do you talk about content/image sliders or range sliders? For image sliders, use slickjs. for range sliders use nouislider.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.