js bug fix

This commit is contained in:
Bachir Soussi Chiadmi 2024-09-25 16:46:35 +02:00
parent 85489abd5f
commit 62beb50067
2 changed files with 82 additions and 65 deletions

View File

@ -1,10 +1,11 @@
document.addEventListener('scroll', function() { document.addEventListener('scroll', function() {
const scrolled = window.pageYOffset; const scrolled = window.pageYOffset;
const background = document.getElementById('background-animated'); const background = document.getElementById('background-animated');
if (background) {
// Adjust this value to control the speed of the parallax effect // Adjust this value to control the speed of the parallax effect
const parallaxSpeed = 0.2; const parallaxSpeed = 0.2;
background.style.transform = 'translateY(' + (scrolled * parallaxSpeed) + 'px)'; background.style.transform = 'translateY(' + (scrolled * parallaxSpeed) + 'px)';
}
}); });
@ -34,8 +35,9 @@ document.addEventListener('scroll', function() {
//ANimation Pilliers //ANimation Pilliers
const svg = document.querySelector('#paragraph-id--7 .colone-picto'); const svg = document.querySelector('#paragraph-id--7 .colone-picto');
// Configuration de l'observateur d'intersection if (svg) {
const observer = new IntersectionObserver(entries => { // Configuration de l'observateur d'intersection
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => { entries.forEach(entry => {
if (entry.isIntersecting) { if (entry.isIntersecting) {
// Ajoute une classe lorsque l'élément est visible // Ajoute une classe lorsque l'élément est visible
@ -48,7 +50,9 @@ const observer = new IntersectionObserver(entries => {
// } // }
}); });
}); });
// Observer l'élément SVG // Observer l'élément SVG
observer.observe(svg); observer.observe(svg);
}

View File

@ -340,8 +340,15 @@
} }
// Attach event listeners // Attach event listeners
document.getElementById('arrowPrev').addEventListener('click', prevSlide); let arrowprev = document.getElementById('arrowPrev');
document.getElementById('arrowNext').addEventListener('click', nextSlide); if (arrowprev) {
arrowprev.addEventListener('click', prevSlide);
}
let arrownext = document.getElementById('arrowNext')
if (arrownext) {
arrownext.addEventListener('click', nextSlide);
}
// Update month field to only show the first 3 letters // Update month field to only show the first 3 letters
document.querySelectorAll('.paragraph--type--phase-deroulement').forEach(function(paragraph) { document.querySelectorAll('.paragraph--type--phase-deroulement').forEach(function(paragraph) {
@ -427,7 +434,9 @@
//////////// slideshow home ////////////////////////// //////////// slideshow home //////////////////////////
$(document).ready(function(){ $(document).ready(function(){
$('.content-actus .view').slick({ let actuview = $('.content-actus .view')
if (actuview) {
actuview.slick({
slidesToShow: 3, slidesToShow: 3,
// slidesToScroll: 1, // slidesToScroll: 1,
dots: false, dots: false,
@ -454,25 +463,29 @@
}); });
console.log('salut slick home'); console.log('salut slick home');
}
}); });
////////////////////// start diaporama home swiper ///////////////////////////////// ////////////////////// start diaporama home swiper /////////////////////////////////
$(document).ready(function () { // PAS DE SWIPER CHARGÉ DANS L'ENV JS ...
//initialize swiper when document ready
var mySwiper = new Swiper ('.swiper-container', {
speed: 400, // $(document).ready(function () {
spaceBetween: 100, // //initialize swiper when document ready
// Optional parameters // let mySwiper = new Swiper ('.swiper-container', {
autoplay: {
delay: 3000, // speed: 400,
disableOnInteraction: false, // spaceBetween: 100,
}, // // Optional parameters
direction: 'horizontal', // autoplay: {
loop: true, // delay: 3000,
}) // disableOnInteraction: false,
}); // },
// direction: 'horizontal',
// loop: true,
// })
// });
////////////////////// end diaporama home swiper ///////////////////////////////// ////////////////////// end diaporama home swiper /////////////////////////////////