Advertisement
Guest User

Evan

a guest
Apr 27th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.29 KB | None | 0 0
  1. <div class="slideshow-container">
  2.           <div class="mySlides fade">
  3.             <div class="numbertext">1 / 3</div>
  4.             <img src="img/slideshow/pic1.jpg" style="width:100%">
  5.             <div class="text">Caption Text</div>
  6.           </div>
  7.  
  8.           <div class="mySlides fade">
  9.             <div class="numbertext">2 / 3</div>
  10.             <img src="img/slideshow/pic2.jpg" style="width:100%">
  11.             <div class="text">Caption Two</div>
  12.           </div>
  13.  
  14.           <div class="mySlides fade">
  15.             <div class="numbertext">3 / 3</div>
  16.             <img src="img3.jpg" style="width:100%">
  17.             <div class="text">Caption Three</div>
  18.           </div>
  19.  
  20.           <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
  21.           <a class="next" onclick="plusSlides(1)">&#10095;</a>
  22.         </div>
  23.         <br>
  24.  
  25.         <div style="text-align:center">
  26.           <span class="dot" onclick="currentSlide(1)"></span>
  27.           <span class="dot" onclick="currentSlide(2)"></span>
  28.           <span class="dot" onclick="currentSlide(3)"></span>
  29.         </div>
  30.  
  31. //////////////////////////////////////////////////////////////////
  32.  
  33. .slideshow-container {
  34.   max-width: 1000px;
  35.   position: relative;
  36.   margin: auto;
  37. }
  38.  
  39. .mySlides {
  40.     display: none;
  41. }
  42.  
  43. /* Next & previous buttons */
  44. .prev, .next {
  45.  cursor: pointer;
  46.   position: absolute;
  47.   top: 50%;
  48.   width: auto;
  49.   margin-top: -22px;
  50.   padding: 16px;
  51.   color: white;
  52.   font-weight: bold;
  53.   font-size: 18px;
  54.   transition: 0.6s ease;
  55.   border-radius: 0 3px 3px 0;
  56. }
  57.  
  58. /* Position the "next button" to the right */
  59. .next {
  60.   right: 0;
  61.   border-radius: 3px 0 0 3px;
  62. }
  63.  
  64. /* On hover, add a black background color with a little bit see-through */
  65. .prev:hover, .next:hover {
  66.   background-color: rgba(0,0,0,0.8);
  67. }
  68.  
  69. /* Caption text */
  70. .text {
  71.   color: #f2f2f2;
  72.   font-size: 15px;
  73.   padding: 8px 12px;
  74.   position: absolute;
  75.   bottom: 8px;
  76.   width: 100%;
  77.   text-align: center;
  78. }
  79.  
  80. /* Number text (1/3 etc) */
  81. .numbertext {
  82.   color: #f2f2f2;
  83.   font-size: 12px;
  84.   padding: 8px 12px;
  85.   position: absolute;
  86.   top: 0;
  87. }
  88.  
  89. /* The dots/bullets/indicators */
  90. .dot {
  91.   cursor:pointer;
  92.   height: 13px;
  93.   width: 13px;
  94.   margin: 0 2px;
  95.   background-color: #bbb;
  96.   border-radius: 50%;
  97.   display: inline-block;
  98.   transition: background-color 0.6s ease;
  99. }
  100.  
  101. .active, .dot:hover {
  102.   background-color: #717171;
  103. }
  104.  
  105. /* Fading animation */
  106. .fade {
  107.   -webkit-animation-name: fade;
  108.   -webkit-animation-duration: 1.5s;
  109.   animation-name: fade;
  110.   animation-duration: 1.5s;
  111. }
  112.  
  113. @-webkit-keyframes fade {
  114.   from {opacity: .4}
  115.   to {opacity: 1}
  116. }
  117.  
  118. @keyframes fade {
  119.   from {opacity: .4}
  120.   to {opacity: 1}
  121. }
  122.  
  123. ////////////////////////////////////////////////////////////////////
  124.  
  125.  
  126.  
  127.  
  128. var slideIndex = 1;
  129. showSlides(slideIndex);
  130.  
  131. function plusSlides(n) {
  132.   showSlides(slideIndex += n);
  133. }
  134.  
  135. function currentSlide(n) {
  136.   showSlides(slideIndex = n);
  137. }
  138.  
  139. function showSlides(n) {
  140.   var i;
  141.   var slides = document.getElementsByClassName("mySlides");
  142.   var dots = document.getElementsByClassName("dot");
  143.   if (n > slides.length) {slideIndex = 1}
  144.   if (n < 1) {slideIndex = slides.length}
  145.  for (i = 0; i < slides.length; i++) {
  146.      slides[i].style.display = "none";
  147.  }
  148.  for (i = 0; i < dots.length; i++) {
  149.      dots[i].className = dots[i].className.replace(" active", "");
  150.  }
  151.  slides[slideIndex-1].style.display = "block";
  152.  dots[slideIndex-1].className += " active";
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement