mirror of
https://github.com/Rushilwiz/brancher.git
synced 2025-04-20 12:00:16 -04:00
EVEN BETTER SLIDING
This commit is contained in:
parent
762fa7f476
commit
b1e37a8649
69
sliders.html
69
sliders.html
|
@ -3,9 +3,9 @@
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<style>
|
<style>
|
||||||
* {box-sizing: border-box}
|
* {box-sizing: border-box;}
|
||||||
body {font-family: Verdana, sans-serif; margin:0}
|
body {font-family: Verdana, sans-serif;}
|
||||||
.mySlides {display: none}
|
.mySlides {display: none;}
|
||||||
img {vertical-align: middle;}
|
img {vertical-align: middle;}
|
||||||
|
|
||||||
/* Slideshow container */
|
/* Slideshow container */
|
||||||
|
@ -15,33 +15,6 @@ img {vertical-align: middle;}
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next & previous buttons */
|
|
||||||
.prev, .next {
|
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
width: auto;
|
|
||||||
padding: 16px;
|
|
||||||
margin-top: -22px;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 18px;
|
|
||||||
transition: 0.6s ease;
|
|
||||||
border-radius: 0 3px 3px 0;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Position the "next button" to the right */
|
|
||||||
.next {
|
|
||||||
right: 0;
|
|
||||||
border-radius: 3px 0 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On hover, add a black background color with a little bit see-through */
|
|
||||||
.prev:hover, .next:hover {
|
|
||||||
background-color: rgba(0,0,0,0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Caption text */
|
/* Caption text */
|
||||||
.text {
|
.text {
|
||||||
color: #f2f2f2;
|
color: #f2f2f2;
|
||||||
|
@ -64,7 +37,6 @@ img {vertical-align: middle;}
|
||||||
|
|
||||||
/* The dots/bullets/indicators */
|
/* The dots/bullets/indicators */
|
||||||
.dot {
|
.dot {
|
||||||
cursor: pointer;
|
|
||||||
height: 15px;
|
height: 15px;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
|
@ -74,7 +46,7 @@ img {vertical-align: middle;}
|
||||||
transition: background-color 0.6s ease;
|
transition: background-color 0.6s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.active, .dot:hover {
|
.active {
|
||||||
background-color: #717171;
|
background-color: #717171;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,12 +70,15 @@ img {vertical-align: middle;}
|
||||||
|
|
||||||
/* On smaller screens, decrease text size */
|
/* On smaller screens, decrease text size */
|
||||||
@media only screen and (max-width: 300px) {
|
@media only screen and (max-width: 300px) {
|
||||||
.prev, .next,.text {font-size: 11px}
|
.text {font-size: 11px}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<h2>Automatic Slideshow</h2>
|
||||||
|
<p>Change image every 2 seconds:</p>
|
||||||
|
|
||||||
<div class="slideshow-container">
|
<div class="slideshow-container">
|
||||||
|
|
||||||
<div class="mySlides fade">
|
<div class="mySlides fade">
|
||||||
|
@ -124,44 +99,34 @@ img {vertical-align: middle;}
|
||||||
<div class="text">Caption Three</div>
|
<div class="text">Caption Three</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="prev" onclick="plusSlides(-1)">❮</a>
|
|
||||||
<a class="next" onclick="plusSlides(1)">❯</a>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<span class="dot" onclick="currentSlide(1)"></span>
|
<span class="dot"></span>
|
||||||
<span class="dot" onclick="currentSlide(2)"></span>
|
<span class="dot"></span>
|
||||||
<span class="dot" onclick="currentSlide(3)"></span>
|
<span class="dot"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var slideIndex = 1;
|
var slideIndex = 0;
|
||||||
showSlides(slideIndex);
|
showSlides();
|
||||||
|
|
||||||
function plusSlides(n) {
|
function showSlides() {
|
||||||
showSlides(slideIndex += n);
|
|
||||||
}
|
|
||||||
|
|
||||||
function currentSlide(n) {
|
|
||||||
showSlides(slideIndex = n);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showSlides(n) {
|
|
||||||
var i;
|
var i;
|
||||||
var slides = document.getElementsByClassName("mySlides");
|
var slides = document.getElementsByClassName("mySlides");
|
||||||
var dots = document.getElementsByClassName("dot");
|
var dots = document.getElementsByClassName("dot");
|
||||||
if (n > slides.length) {slideIndex = 1}
|
|
||||||
if (n < 1) {slideIndex = slides.length}
|
|
||||||
for (i = 0; i < slides.length; i++) {
|
for (i = 0; i < slides.length; i++) {
|
||||||
slides[i].style.display = "none";
|
slides[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
slideIndex++;
|
||||||
|
if (slideIndex > slides.length) {slideIndex = 1}
|
||||||
for (i = 0; i < dots.length; i++) {
|
for (i = 0; i < dots.length; i++) {
|
||||||
dots[i].className = dots[i].className.replace(" active", "");
|
dots[i].className = dots[i].className.replace(" active", "");
|
||||||
}
|
}
|
||||||
slides[slideIndex-1].style.display = "block";
|
slides[slideIndex-1].style.display = "block";
|
||||||
dots[slideIndex-1].className += " active";
|
dots[slideIndex-1].className += " active";
|
||||||
|
setTimeout(showSlides, 2000); // Change image every 2 seconds
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user