slideshow for parallax

This commit is contained in:
2021-04-16 14:02:04 +02:00
parent dc105832a2
commit a523f80efa
2 changed files with 85 additions and 0 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

@@ -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");