am acest cod cu ajutorul caruia pot rula mai multe imaigini de tip slideshow, dar se opreste la imaginea nr patru si nu stiu care e problema.
Cod: Selectaţi tot
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: black;
margin:0 auto;
}
.continut{
margin:10px;
padding:20px;
width:1400px;
height:700px;
border:2px solid black;
background-image: url("gradient.png");
}
.slideshow-container {
max-width: 700px;
position: relative;
margin: auto;
padding:20px;
}
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
}
.dot {
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active {
background-color: #717171;
}
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 3s;
}
@-webkit-keyframes fade {
from {opacity: .2}
to {opacity: 2}
}
@keyframes fade {
from {opacity: .2}
to {opacity: 2}
}
</style>
</head>
<body>
<div class="continut">
<div class="slideshow-container">
<div class="mySlides fade">
<div class="numbertext">1 / 6</div>
<img src="unu.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<div class="numbertext">2 / 6</div>
<img src="doi.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<div class="numbertext">3 / 6</div>
<img src="trei.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<div class="numbertext">4 / 6</div>
<img src="patru.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<div class="numbertext">5 / 6</div>
<img src="unu.jpg" style="width:100%">
</div>
<div class="mySlides fade">
<div class="numbertext">6 / 6</div>
<img src="sase.jpg" style="width:100%">
</div>
</div>
<br>
<div style="text-align:center">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
</div>
<script>
var slideIndex = 0;
showSlides();
function showSlides() {
var i;
var slides = document.getElementsByClassName("mySlides fade");
var dots = document.getElementsByClassName("dot");
for (i = 0; i < slides.length; i++) {
slides.style.display = "none";
}
slideIndex++;
if (slideIndex > slides.length) {slideIndex = 0}
for (i = 0; i < dots.length; i++) {
dots.className = dots.className.replace(" active", "block");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className = " active";
setTimeout(showSlides, 2000);
}
</script>
</body>
</html>