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,21 +35,24 @@ 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
entries.forEach(entry => { const observer = new IntersectionObserver(entries => {
if (entry.isIntersecting) { entries.forEach(entry => {
// Ajoute une classe lorsque l'élément est visible if (entry.isIntersecting) {
// svg.classList.remove('invisible'); // Ajoute une classe lorsque l'élément est visible
svg.classList.add('visible'); // svg.classList.remove('invisible');
} svg.classList.add('visible');
// else { }
// // Optionnel : Retirez la classe si nécessaire // else {
// svg.classList.remove('visible'); // // Optionnel : Retirez la classe si nécessaire
// svg.classList.remove('visible');
// }
// }
});
}); });
});
// Observer l'élément SVG
// Observer l'élément SVG observer.observe(svg);
observer.observe(svg);
}

View File

@ -340,9 +340,16 @@
} }
// 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) {
const monthField = paragraph.querySelector('.field_field_date_de_moi div:nth-of-type(2)'); const monthField = paragraph.querySelector('.field_field_date_de_moi div:nth-of-type(2)');
@ -427,52 +434,58 @@
//////////// slideshow home ////////////////////////// //////////// slideshow home //////////////////////////
$(document).ready(function(){ $(document).ready(function(){
$('.content-actus .view').slick({ let actuview = $('.content-actus .view')
slidesToShow: 3, if (actuview) {
// slidesToScroll: 1, actuview.slick({
dots: false, slidesToShow: 3,
arrows: true, // slidesToScroll: 1,
centerMode: true, dots: false,
adaptiveHeight: true, arrows: true,
autoplay: false, centerMode: true,
// autoplaySpeed: 1500, adaptiveHeight: true,
// infinite: true, autoplay: false,
// centerPadding: '100px', // autoplaySpeed: 1500,
responsive: [ // infinite: true,
{ // centerPadding: '100px',
breakpoint: 810, responsive: [
settings: { {
slidesToShow: 1, breakpoint: 810,
adaptiveHeight: false, settings: {
arrows: true, slidesToShow: 1,
draggable: true, adaptiveHeight: false,
centerMode: true, arrows: true,
autoplay: false, draggable: true,
// autoplaySpeed: 2000, centerMode: true,
} autoplay: false,
}] // autoplaySpeed: 2000,
}); }
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', { // $(document).ready(function () {
// //initialize swiper when document ready
// let mySwiper = new Swiper ('.swiper-container', {
speed: 400, // speed: 400,
spaceBetween: 100, // spaceBetween: 100,
// Optional parameters // // Optional parameters
autoplay: { // autoplay: {
delay: 3000, // delay: 3000,
disableOnInteraction: false, // disableOnInteraction: false,
}, // },
direction: 'horizontal', // direction: 'horizontal',
loop: true, // loop: true,
}) // })
}); // });
////////////////////// end diaporama home swiper ///////////////////////////////// ////////////////////// end diaporama home swiper /////////////////////////////////