/**
* Created by Joachim Jahr on 20/06/2017. */
var slideIndex = 1; var Carousel_timer;
function plusDivs(n) {
showDivs(slideIndex += n);
}
function changeToDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i; var active; var x = document.getElementsByClassName("slideshow_picture"); var dots = document.getElementsByClassName("dot"); if (n > x.length) {slideIndex = 1} if (n < 1) {slideIndex = x.length} for (i = 0; i < x.length; i++) { if (x[i].style.display === "inline"){ active = x[i]; } } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" current_dot", ""); } $(active).fadeOut(500, function () { $(x[slideIndex-1]).fadeIn(500); }); dots[slideIndex-1].className += " current_dot"; clearTimeout(Carousel_timer); Carousel_timer = setTimeout(carousel, 10000); // wait 10 seconds for next automatic image change
}
function carousel() { //Is called to change pictures automatically
plusDivs(1);
}
$(document).ready(function () {
document.getElementsByClassName("slideshow_picture")[0].style.display = "inline"; showDivs(slideIndex);
});