creating/using a carousel for your site
nav_first.pngFirst: blog:1
Private Server Community
Edited: 05 Jun 2017 17:47 by: Slater River
Comments: 0
Tags: aqwps partner plasmily private-server shutdown slater-river
nav_prev.pngPrevious: blog:12
check out this link for my friend
Edited: 30 Jul 2017 22:01 by: Slater River
Comments: 0
Tags:
nav_last.pngLast: blog:15
calling out to all programmers
Edited: 14 Sep 2017 17:33 by: Slater River
Comments: 0
Tags: apply calling css html javasript out php programmers requirements skills
nav_next.pngNext: blog:14
password protected folders
Edited: 18 Aug 2017 17:33 by: Slater River
Comments: 0
Tags: batch cool-code folder password-protected

Slater RiverSlater River wrote on 14 Aug 2017 17:46
Tags:

So I know that my style when I design and develop websites is to use a carousel. To me that is just how I like to have websites just look. Well I will try to help you install a carousel if you want that extra touch for your site in the header.

I have gotten this code from the W3Schools
site so the credit goes really to them.

Open a new file and put the following code:

var slideIndex = 1;
showSlides(slideIndex);
 
function plusSlides(n) {
  showSlides(slideIndex += n);
}
 
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";
}
 
var slideIndex = 0;
showSlides();
 
function showSlides() {
    var i;
    var slides = document.getElementsByClassName("mySlides");
    for (i = 0; i < slides.length; i++) {
        slides[i].style.display = "none"; 
    }
    slideIndex++;
    if (slideIndex> slides.length) {slideIndex = 1} 
    slides[slideIndex-1].style.display = "block"; 
    setTimeout(showSlides, 2000); // Change image every 2 seconds
}

Now once you do that you want to put the next set of code where you desire it to be for site.

 <!-- Start of Carousel -->
    <div class="slideshow-container">
  <div class="mySlides fade">
    <div class="numbertext">1 / 3</div>
    <img src="img1.jpg" style="width:100%">
    <div class="text">Caption Text</div>
  </div>
 
  <div class="mySlides fade">
    <div class="numbertext">2 / 3</div>
    <img src="img2.jpg" style="width:100%">
    <div class="text">Caption Two</div>
  </div>
 
  <div class="mySlides fade">
    <div class="numbertext">3 / 3</div>
    <img src="img3.jpg" style="width:100%">
    <div class="text">Caption Three</div>
  </div>
 
  <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
  <a class="next" onclick="plusSlides(1)">&#10095;</a>
</div>
<br>
 
<div style="text-align:center">
  <span class="dot" onclick="currentSlide(1)"></span> 
  <span class="dot" onclick="currentSlide(2)"></span> 
  <span class="dot" onclick="currentSlide(3)"></span> 
</div>
    <!-- End of Carousel -->

Now once you do that you can customize the code to your desire. Note that it's pretty self-explanatory.

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License