javascript - image carousel/slideshow with prev/next button -


i have follow tutorial w3school

now want improve prev / next indicators, not slider

this want achieve

example

also code

example

or

var slideindex = 1;  showdivs(slideindex);    function plusdivs(n) {    showdivs(slideindex += n);  }    function currentdiv(n) {    showdivs(slideindex = n);  }    function showdivs(n) {    var i;    var x = document.getelementsbyclassname("myslides");    var dots = document.getelementsbyclassname("demo");    if (n > x.length) {slideindex = 1}    if (n < 1) {slideindex = x.length}    (i = 0; < x.length; i++) {       x[i].style.display = "none";    }    (i = 0; < dots.length; i++) {       dots[i].classname = dots[i].classname.replace(" w3-opacity-off", "");    }    x[slideindex-1].style.display = "block";    dots[slideindex-1].classname += " w3-opacity-off";  }
#indi {    width: 200px;    float:left;  }
<body>    <div class="w3-content" style="max-width:1200px">    <img class="myslides" src="https://www.w3schools.com/w3css/img_mountains.jpg" style="width:100%">    <img class="myslides" src="https://www.w3schools.com/w3css/img_fjords_wide.jpg" style="width:100%">    <img class="myslides" src="https://www.w3schools.com/w3css/img_mountains_wide.jpg" style="width:100%">      <div class="w3-row-padding w3-section">      <div  id="indi" class="w3-col s4">        <img  class="demo w3-opacity w3-hover-opacity-off" src="https://www.w3schools.com/w3css/img_nature_wide.jpg" style="width:100%" onclick="currentdiv(1)">      </div>      <div id="indi" class="w3-col s4">        <img class="demo w3-opacity w3-hover-opacity-off" src="https://www.w3schools.com/w3css/img_fjords_wide.jpg" style="width:100%" onclick="currentdiv(2)">      </div>      <div id="indi" class="w3-col s4">        <img  class="demo w3-opacity w3-hover-opacity-off" src="https://www.w3schools.com/w3css/img_mountains_wide.jpg" style="width:100%" onclick="currentdiv(3)">      </div>    </div>  </div>    </body>

thanks before, appreciated

next:

$("#next").click(function () { $("#container div:eq(" + num + ")").slideup(450); num = (num + 1) % 4; $("#container div:eq(" + num + ")").fadein(450); }); 

last:

$("#last").click(function () { $("#container div:eq(" + num + ")").slideup(450); num = 4; $("#container div:eq(" + num + ")").fadein(450); }); 

this has been asked , answered - how add buttons javascript/jquery slider?

if need more specific please don't hesitate ask though.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -