1
I made a slideshow root with Jquery
using setInterval
to change the slides after a few seconds. It works fine, however, if I change tab and after some time come back, the animation gets "bugged" and passes the slides very fast.
Here is the website. The initial slide is the first background slide you see.
Slideshow Code
<div class="slideshow">
<img src="images/152156263613548.jpg" class="slide slide1 active_slide" data-slide="1">
<img src="images/capaaaa.jpg" class="slide slide2" data-slide="2">
<img src="images/casa_das_artes.jpg" class="slide slide3" data-slide="3">
</div>
setInterval(function(){
var slide = $(".active_slide").attr("data-slide");
var next = parseInt(slide)+1;
if($(".slide"+next).length > 0){
$(".slide"+slide).removeClass("active_slide");
$(".slide"+slide).fadeOut(1000);
$(".slide"+next).addClass("active_slide");
$(".slide"+next).fadeIn(700).css("display","block");;
}else{
$(".slide"+slide).removeClass("active_slide");
$(".slide"+slide).fadeOut(1000);
$(".slide1").addClass("active_slide");
$(".slide1").fadeIn(700).css("display","block");;
}
},4000);
If you can’t solve speak to me. Da to make this same Slide only with CSS, you don’t need JS to achieve that same effect... If you want I can make an example for you
– hugocsl
@hugocsl I know it’s possible but as a beginner programmer I did this without help and felt concretized by it working except for this little problem
– I_like_trains
Cool young the result was 99%, only a user who stand there a long time is going to see this rss. However already someone already answers you, unfortunately JS do not understand anything...
– hugocsl
But if you can then give an example in css I would be very grateful
– I_like_trains