Move slideshow to the left

0

I made a slide show but I can not move to the left. I wanted to move my slide show to the left and then to the right.

My code:

<div class="w3-content w3-display-container">

<div class="w3-display-container mySlides">
  <img src="horta/1.jpg" width="500" height="600"style="width:100%">
</div>

<div class="w3-display-container mySlides">
  <img src="horta/2.jpg"width="500" height="600"  style="width:100%">
</div>

<div class="w3-display-container mySlides">
  <img src="horta/3.jpg" width="500" height="600" style="width:100%">
</div>

<div class="w3-display-container mySlides">
  <img src="horta/4.jpg" width="500" height="600" style="width:100%">    
</div>

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

</div>
<script>
var slideIndex = 1;
showDivs(slideIndex);

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";  
}
</script>
    
asked by anonymous 30.12.2017 / 17:12

0 answers