integration/v2/js/slideshow.js
changeset 203 df9a887eae92
parent 190 ebb8b58fc2b8
child 206 24607434c13b
equal deleted inserted replaced
202:af621f52de70 203:df9a887eae92
    81         currentSlide = (currentSlide > 0 ? currentSlide - 1 : slides.length - 1);
    81         currentSlide = (currentSlide > 0 ? currentSlide - 1 : slides.length - 1);
    82         showSlide();
    82         showSlide();
    83         return false;
    83         return false;
    84     }
    84     }
    85     
    85     
    86     var hideTO, isInArrow = false, jqArrows = $(".arrow-wrap");
    86     var hideTO, isInArrow = false, jqControls = $(".arrow-wrap,.top-controls");
    87     function resetTO() {
    87     function resetTO() {
    88         clearTimeout(hideTO);
    88         clearTimeout(hideTO);
    89         if (!isInArrow) {
    89         if (!isInArrow) {
    90             hideTO = setTimeout(function() {
    90             hideTO = setTimeout(function() {
    91                 jqArrows.hide();
    91                 jqControls.hide();
    92             }, 1000);
    92             }, 1000);
    93         }
    93         }
    94     }
    94     }
    95     $("body").mousemove(function() {
    95     $("body").mousemove(function() {
    96         jqArrows.show();
    96         jqControls.show();
    97         resetTO();
    97         resetTO();
    98         return false;
    98         return false;
    99     });
    99     });
   100     jqArrows.hover(function() {
   100     jqControls.hover(function() {
   101         isInArrow = true;
   101         isInArrow = true;
   102         resetTO();
   102         resetTO();
   103     }, function() {
   103     }, function() {
   104         isInArrow = false;
   104         isInArrow = false;
   105         resetTO();
   105         resetTO();
   106     });
   106     });
   107     
   107     
   108     $(".left-arrow").click(prevSlide);
   108     $(".left-arrow").click(prevSlide);
   109     $(".right-arrow").click(nextSlide);
   109     $(".right-arrow").click(nextSlide);
       
   110     
       
   111     function fullScreen() {
       
   112         var isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || false;
       
   113         if (isFull) {
       
   114             (document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen || function(){}).call(document);
       
   115         } else {
       
   116             (document.body.requestFullScreen || document.body.mozRequestFullScreen || document.body.webkitRequestFullScreen || function(){}).call(document.body);
       
   117         }
       
   118         showSlide();
       
   119         return false;
       
   120     }
       
   121     
       
   122     $(".full-screen").click(fullScreen);
       
   123            
       
   124     if ( typeof document.fullScreen === "undefined"
       
   125         && typeof document.mozFullScreen === "undefined"
       
   126         && typeof document.webkitIsFullScreen === "undefined") {
       
   127         $(".full-screen").remove();
       
   128     }
       
   129     
       
   130     var playInterval, playing = false;
       
   131     
       
   132     $(".play-pause").click(function() {
       
   133         clearInterval(playInterval);
       
   134         playing = !playing;
       
   135         if (playing) {
       
   136             $(this).addClass("pause");
       
   137             playInterval = setInterval(nextSlide,4000);
       
   138         } else {
       
   139             $(this).removeClass("pause");
       
   140         }
       
   141         return false;
       
   142     });
   110     
   143     
   111     slides.forEach(function(slide, k) {
   144     slides.forEach(function(slide, k) {
   112         if (!slide.path) {
   145         if (!slide.path) {
   113             slide.path = "M0 0L1 0L1 1L0 1Z"
   146             slide.path = "M0 0L1 0L1 1L0 1Z"
   114         }
   147         }