Sfoglia il codice sorgente

slideshow for parallax

ouidade 3 anni fa
parent
commit
a523f80efa

BIN
user/themes/epau-antimatter/images/hyperliens_marseille.PNG


+ 85 - 0
user/themes/epau-antimatter/js/antimatter.js

@@ -25,6 +25,10 @@ function scrollHeader() {
 // };
 
 
+
+
+
+
 jQuery(document).ready(function($){
 
 //bouton "voir plus de ressources"
@@ -40,6 +44,87 @@ jQuery(document).ready(function($){
     }
   	});
 
+    // parallax slideshow
+    $(document).ready(function() {
+  var imgSrc = ["/user/themes/epau-antimatter/images/14360_default_big.jpg", "/user/themes/epau-antimatter/images/10361_web_01.jpg", "/user/themes/epau-antimatter/images/hyperliens_marseille_.PNG"];
+
+  var counter = 1;
+  var duration = 4000;
+  var tTime = 300;
+  var v = setInterval(function() {
+      $('.parallax-mirror').animate({
+        'opacity': 0
+      }, {
+        duration: tTime,
+        complete: function() {
+
+          $(this).find('img').attr('src', imgSrc[counter]).end().animate({
+            'opacity': 1
+          }, tTime);
+
+        }
+      });
+
+      if (counter > imgSrc.length - 1) {
+        counter = 0
+      } else {
+        counter++
+      };
+    },
+    duration);
+
+
+});
+
+    // var imagesArray = [ url("/user/themes/epau-antimatter/images/14360_default_big.jpg") ,
+    //                     url("/user/themes/epau-antimatter/images/10361_web_01.jpg") ,
+    //                     url("/user/themes/epau-antimatter/images/hyperliens_marseille_.PNG") ,
+    //                     url("/user/themes/epau-antimatter/images/jeux-olypiques-paris-2024-village-athle-lot-e2.jpg") ;];
+    //
+    // function preloadImg(pictureUrls, callback) {
+    //   var i, j, loaded = 0;
+    //   var imagesArray = [];
+    //
+    //   for (i = 0, j = pictureUrls.length; i < j; i++) {
+    //     imagesArray.push(new Image());
+    //   }
+    //   for (i = 0, j = pictureUrls.length; i < j; i++) {
+    //     (function (img, src) {
+    //       img.onload = function () {
+    //         if (++loaded == pictureUrls.length && callback) {
+    //           callback(imagesArray);
+    //         }
+    //       };
+    //       img.src = src;
+    //     }(imagesArray[i], pictureUrls[i]));
+    //   }
+    // };
+    //
+    //
+    // function roll(imagesArray, currentPos, max){
+    //   if (max < 0) {
+    //     return;
+    //   }
+    //   var slide = $('.parallax-mirror').find('img').attr('src', imagesArray[currentPos].src);
+    //   slide.fadeIn(2000, function() {
+    //     slide.fadeOut(1500, function() {
+    //       currentPos++;
+    //       if(currentPos >= imagesArray.length){
+    //         currentPos = 0;
+    //         max--;
+    //       }
+    //       roll(imagesArray, currentPos, max);
+    //     });
+    //   });
+    // }
+    //
+    // $(function () {
+    //   preloadImg(imagesArray, function (imagesArray) {
+    //     roll(imagesArray, 0, 3);
+    //   });
+    // });
+    //
+
 // // souligne apparait on scrollLock
 //     $(function () {
 //       var element = $("#triggerOnScroll");