Facebook
From BidyaPremi (Collected), 2 Years ago, written in HTML5.
Embed
Download Paste or View Raw
Hits: 126
  1. .mySlides{display:none}
  2. .mySlides img {vertical-align:middle;width:100%}
  3. .wrap-dot{text-align:center;margin-top:10px}
  4. .slideshow-container{max-width:1000px;position:relative;margin:auto}
  5. .slideshow-container .prev,.slideshow-container
  6. .next{cursor:pointer;position:absolute;top:50%;padding:5px 15px;margin:-22px 5px 0 5px;color:white;font-weight:bold;font-size:18px;transition:0.6s ease;border-radius:50%;user-select:none}
  7. .slideshow-container .next{right:0}
  8. .slideshow-container .prev:hover,.slideshow-container .next:hover{background-color:rgba(0,0,0,0.8)}
  9. .slideshow-container .text{color:#f2f2f2;font-size:15px;padding:8px 12px;position:absolute;bottom:8px;width:100%;text-align:center}
  10. .wrap-dot .dot{cursor:pointer;height:15px;width:15px;margin:0 2px;background-color:#bbb;border-radius:50%;display:inline-block;transition:background-color 0.6s ease}
  11. .wrap-dot .dot.active{background-color:#00ff00;width:30px;border-radius:20px}
  12. .fade{-webkit-animation-name:fade;-webkit-animation-duration:1.5s;animation-name:fade;animation-duration:1.5s}
  13. @-webkit-keyframes fade{from{opacity:.4}to{opacity:1}}@keyframes fade{from{opacity:.4}to{opacity:1}}
  14. @media only screen and (max-width:300px){.slideshow-container
  15. .prev,.slideshow-container .next,.slideshow-container .text{font-size:11px}} </style>
  16.  
  17.  
  18.  
  19.  
  20. <div class="slideshow-container">
  21. <div class="mySlides fade">
  22.   <a href='#'>
  23.   <img src="https://p2.piqsels.com/preview/560/572/15/children-cute-excited-excitement.jpg"/>
  24.   <div class="text">Caption Text</div>
  25.   </a>
  26. </div>
  27.  
  28. <div class="mySlides fade">
  29.   <a href='#'>
  30.   <img src="https://p2.piqsels.com/preview/898/399/802/people-mother-daughter-baby.jpg"/>
  31.   <div class="text">Caption Two</div>
  32.   </a>
  33. </div>
  34.  
  35. <div class="mySlides fade">
  36.   <a href='#'>
  37.   <img src="https://p0.piqsels.com/preview/735/640/842/mother-baby-happy-smiling.jpg"/>
  38.   <div class="text">Caption Three</div>
  39.   </a>
  40. </div>
  41.  
  42.   <div class="mySlides fade">
  43.   <a href='#'>
  44.   <img src="https://p0.piqsels.com/preview/829/443/586/children-boys-family-books.jpg"/>
  45.   <div class="text">Caption Three</div>
  46.   </a>
  47. </div>
  48. <a class="prev" onclick="prevSlide()">&#10094;</a>
  49. <a class="next" onclick="showSlides()">&#10095;</a>
  50. </div>
  51.  
  52. <div class='wrap-dot'>
  53.   <span class="dot"></span>
  54.   <span class="dot"></span>
  55.   <span class="dot"></span>
  56.   <span class="dot"></span>
  57. </div>
  58.  
  59.  
  60. var timeOut = 2000;
  61. var slideIndex = 0;
  62. var autoOn = true;
  63.  
  64. autoSlides();
  65.  
  66. function autoSlides() {
  67.   timeOut = timeOut - 20;
  68.   if (autoOn == true && timeOut < 0) {
  69.    showSlides();
  70.   }
  71.   setTimeout(autoSlides, 20);
  72. }
  73.  
  74. function prevSlide() {
  75.   timeOut = 2000;
  76.   var slides = document.getElementsByClassName("mySlides");
  77.   var dots = document.getElementsByClassName("dot");
  78.   for (i = 0; i < slides.length; i++) {
  79.    slides[i].style.display = "none";
  80.    dots[i].className = dots[i].className.replace(" active", "");
  81.  }
  82.  slideIndex--;
  83.  
  84.  if (slideIndex > slides.length) {
  85.     slideIndex = 1
  86.   }
  87.   if (slideIndex == 0) {
  88.     slideIndex = 4
  89.   }
  90.   slides[slideIndex - 1].style.display = "block";
  91.   dots[slideIndex - 1].className += " active";
  92.         }
  93.  
  94. function showSlides() {
  95.   timeOut = 2000;
  96.   var slides = document.getElementsByClassName("mySlides");
  97.   var dots = document.getElementsByClassName("dot");
  98.   for (i = 0; i < slides.length; i++) {
  99.    slides[i].style.display = "none";
  100.    dots[i].className = dots[i].className.replace(" active", "");
  101.  }
  102.  slideIndex++;
  103.  
  104.  if (slideIndex > slides.length) {
  105.     slideIndex = 1
  106.   }
  107.   slides[slideIndex - 1].style.display = "block";
  108.   dots[slideIndex - 1].className += " active";
  109. }