Team:TUDelft/js/start-slider

(function () {

   $(function () {
       //slider
       var trans = 500;
       var inter = 6000;
       var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
       if (!h) {
           console.log("ERROR: Cannot find h. Assign default of 700 px.")
           h = 700;
       }
       h = 0.9 * h; 
       $(".slider").slider({
           height: h,
           transition: trans,
           interval: inter,
           indicators: false
       });
       var animated_logo = $('#animated-logo');
       animated_logo.addClass('moved');
       $(".slider").slider('pause');
       var nextSlide = function () {
           $(".slider").slider('next');
       }
       var runSlideShow = function () {
           setTimeout(function () {
               nextSlide()
           }, inter)
           setTimeout(function () {
               nextSlide()
           }, 2 * inter + trans)
           setTimeout(function () {
               nextSlide()
           }, 3 * inter + 2 * trans)
           setTimeout(function () {
               animated_logo.addClass('invisible');
           }, 3 * inter + 1 * trans)
           setTimeout(function () {
               animated_logo.removeClass('invisible');
           }, 4 * inter + 3 * trans)
       }
       runSlideShow();
       setInterval(function () {
           runSlideShow();
       }, 3 * (trans + inter))
   })

}());