AG

American Codes

czwartek, 26 sierpnia 2021

Slider z obrazkami




KOD DO EFEKTU:
<div class="slideshow-container">


  <div class="mySlides fade">
    <img src="LINK1"></div>

  <div class="mySlides fade">
    <img src=" LINK2"></div>

  <div class="mySlides fade">
    <img src=" LINK3 "></div>

</div>

  <!-- Next and previous buttons -->
  <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
  <a class="next" onclick="plusSlides(1)">&#10095;</a>
<br/>


<style>
.carousel-container {
width: 100%;
margin: auto;
overflow: hidden;}

.prev  {
  cursor: pointer;
  position: relative;
  top: -200px;;
  width: auto;
  margin-top: 0px;
  padding: 0px 46px 0px 16px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
opacity: 0.2;
}

.next  {
  cursor: pointer;
  position: relative;
  top: -230px;;
  width: auto;
  margin-left: 570px;
  padding: 0px 46px 0px 16px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
opacity: 0.2;
}

/* Position the "next button" to the right */
.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover, .next:hover {
 opacity: 1;
color: #fff;
}


/* Fading animation */
.fade {
  -webkit-animation-name: fade;
  -webkit-animation-duration: 1.5s;
  animation-name: fade;
  animation-duration: 1.5s;
}

@-webkit-keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}

@keyframes fade {
  from {opacity: .4}
  to {opacity: 1}
}
</style>

<script type='text/javascript'>
var slideIndex = 1;
showSlides(slideIndex);

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

// Thumbnail image controls
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>
▪ Wartości, które możesz edytować zaznaczone są kolorem.
▪ Pierwszy obrazek powinien być kodowany na górze.

Brak komentarzy:

Prześlij komentarz

Szablon wykonany przez Skipper. Obsługiwane przez usługę Blogger.