5W site logo 5W - мой домашний сайт-блог с картинками, кино и плюшками.

js-css-autoslide-w3c.html

<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
.mySlides {display:none;}
</style>
<body>

<h2 class="w3-center">Automatic Slideshow</h2>

<div class="w3-content w3-section" style="max-width:500px">
<img class="mySlides" src="pages/gallery/linuxtheme1/images/screen/dark.png" style="max-width:20em;">
<img class="mySlides" src="pages/gallery/linuxtheme1/images/screen/flat.png" style="max-width:20em;">
<img class="mySlides" src="pages/gallery/linuxtheme1/images/screen/grey.png" style="max-width:20em;">
</div>

<script>
var myIndex = 0;
carousel();

function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 3000); // Change image every 3 seconds
}
</script>

</body>
</html>
Наверх