1//======================= 2//BACKGROUND BLUR EFFECT 3//====================== 4function loadBackGround() { 5 jQuery("div.bgFull").lazyload({ 6 effect: "fadeIn" 7 }); 8} 9 10//======================= 11//GESTION MENU CLAVIER 12//====================== 13function MenuActive() { 14 const menuItems = document.querySelectorAll('.main-nav li'); 15 16 menuItems.forEach(item => { 17 // à l'entrée au focus 18 item.addEventListener('focusin', function() { 19 const subMenu = this.querySelector('.sub-menu'); 20 if (subMenu) { 21 subMenu.style.display = 'block'; // Montrer le sous-menu 22 } 23 }); 24 25 // à la sortie du focus 26 item.addEventListener('focusout', function() { 27 const subMenu = this.querySelector('.sub-menu'); 28 if (subMenu) { 29 // Vérifier si le focus est toujours sur le menu 30 const focusedElement = document.activeElement; 31 if (!item.contains(focusedElement)) { 32 subMenu.style.display = 'none'; // Cacher le sous-menu 33 } 34 } 35 }); 36 }); 37} 38 39// Initialiser le menu lorsque le DOM est prêt 40document.addEventListener('DOMContentLoaded', function() { 41 MenuActive(); // Appel de la fonction pour activer le menu 42}); 43 44 45//======================= 46//GESTION MENU LANGUE CLAVIER 47//====================== 48document.addEventListener('DOMContentLoaded', function() { 49 const toggleButton = document.querySelector('.js-wpml-ls-item-toggle'); 50 const subMenu = document.querySelector('.wpml-ls-sub-menu'); 51 52 if (toggleButton && subMenu) { 53 toggleButton.addEventListener('click', function(event) { 54 event.preventDefault(); // Empêcher le comportement par défaut du lien 55 56 const isExpanded = toggleButton.getAttribute('aria-expanded') === 'true'; 57 subMenu.style.display = isExpanded ? 'none' : 'block'; // Afficher ou cacher le sous-menu 58 toggleButton.setAttribute('aria-expanded', !isExpanded); 59 }); 60 61 // Afficher le sous-menu au focus 62 toggleButton.addEventListener('focusin', function() { 63 subMenu.style.display = 'block'; 64 toggleButton.setAttribute('aria-expanded', 'true'); 65 }); 66 67 // Cacher le sous-menu si le focus est perdu 68 toggleButton.addEventListener('focusout', function() { 69 if (!subMenu.contains(document.activeElement)) { 70 subMenu.style.display = 'none'; 71 toggleButton.setAttribute('aria-expanded', 'false'); 72 } 73 }); 74 } 75}); 76 77//======================= 78//HEADER ACTIF 79//======================= 80function HeaderActive() { 81 jQuery(window).scroll(function () { 82 if (jQuery(this).scrollTop() > 20) { 83 jQuery("#header").addClass('active'); 84 } else { 85 jQuery("#header").removeClass('active'); 86 } 87 }); 88 89 90 if (jQuery(window).width() > 767) { 91 92 jQuery('#menu-item-331').hover(//Sub-menu Espace 93 function () { jQuery("#logo").addClass('active') }, 94 function () { jQuery("#logo").removeClass('active') } 95 ); 96 97 jQuery('#menu-item-1730').hover(//Sub-menu Autour 98 function () { jQuery("#logo").addClass('active') }, 99 function () { jQuery("#logo").removeClass('active') } 100 ); 101 102 103 } 104 105} 106 107 108//======================= 109//SVG CONVERT INLINE 110//======================= 111function SVGinline() { 112 jQuery('img.svg').each(function () { 113 var $img = jQuery(this); 114 var imgID = $img.attr('id'); 115 var imgClass = $img.attr('class'); 116 var imgURL = $img.attr('src'); 117 118 jQuery.get(imgURL, function (data) { 119 // Get the SVG tag, ignore the rest 120 var $svg = jQuery(data).find('svg'); 121 122 // Add replaced image's ID to the new SVG 123 if (typeof imgID !== 'undefined') { 124 $svg = $svg.attr('id', imgID); 125 } 126 // Add replaced image's classes to the new SVG 127 if (typeof imgClass !== 'undefined') { 128 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 129 } 130 131 // Remove any invalid XML tags as per http://validator.w3.org 132 $svg = $svg.removeAttr('xmlns:a'); 133 134 // Check if the viewport is set, else we gonna set it if we can. 135 if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) { 136 $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')) 137 } 138 139 // Replace image with new SVG 140 $img.replaceWith($svg); 141 142 }, 'xml'); 143 144 }); 145} 146 147 148 149//================= 150//NAVIGATION MODIFY 151//================== 152function Navigation() { 153 //ajout du texte avant topLink 154 //jQuery('#menu-top-menu').find('li').eq(0).prepend('<span>Publics spécifiques :</span>'); 155 //jQuery('#menu-top-menu').find('li').eq(0).prepend('<span>Vous êtes : </span>'); 156 //jQuery('#menu-you-are').find('li').eq(0).prepend('<span>You are : </span>'); 157 158 //Reécriture premier lien espaces 159 // if(jQuery(window).width() > 767) {
160 // jQuery('#nested ul.nav').find('li.espaces a').eq(0).html('Les espaces de<br/>La Cité de la Mer'); 161 // } 162 163 //Rajout commentaires/accroche sous item menu principal -> utilisation balise title 164 // jQuery('#menu-menu-principal').find('.sub-menu li a').each(function(){ 165 jQuery('#nested ul.nav').find('.sub-menu li a').each(function () { 166 167 var SousTitre = jQuery(this).attr('title'); 168 //console.log(SousTitre); 169 if (SousTitre != null) { 170 jQuery(this).append('<small>' + SousTitre + '</small>'); 171 } 172 jQuery(this).wrapInner('<span class="full"/>'); 173 }); 174 175 176 //Rajout du lien sur menu de niveau 2 177 // jQuery('#menu-menu-principal').find('.sub-menu li').each(function(){ 178 jQuery('#nested ul.nav').find('.sub-menu li').each(function () { 179 var Link = jQuery('a', this).attr('href'); 180 jQuery('.sep', this).append('<a href="' + Link + '" class="innerSep"></a>') 181 }); 182 183 184 185 //RESPONSIVE TOUCH EVENT 186 if (jQuery(window).width() > 767) { 187 if (Modernizr.touch) { 188 /*//alert('Touch Screen'); 189 //jQuery('#menu-item-6 a:eq(0)').attr('href','javascript:;'); 190 //jQuery('#menu-item-8 a:eq(0)').attr('href','javascript:;'); 191 192 jQuery('#menu-item-331 a:eq(0)').attr('href','javascript:;');//espaces 193 jQuery('#menu-item-434 a:eq(0)').attr('href','javascript:;');//infos*/ 194 195 196 // On désactive le 1er click pour afficher les sous-menus 197 jQuery('#nested > ul > li > a').on('click', function (e) { 198 if (!jQuery(this).is('.clicked')) { 199 e.preventDefault(); 200 jQuery(this).addClass('clicked'); 201 } 202 }); 203 204 205 206 } else { 207 //alert('No Touch Screen'); 208 } 209 } 210 // 211 212 213 214 if (jQuery(window).width() > 766) { 215 /*jQuery( "#smart-toggle" ).click(function() { 216 alert( "Handler for .click() called." ); 217 });*/ 218 219 /*jQuery( "#smart-toggle" ).toggle( 220 function() { 221 jQuery('#nested').toggle(); 222 }, function() { 223 jQuery('#nested').toggle(); 224 } 225 );*/ 226 227 /*jQuery(document).ready(function(){ 228 jQuery("#nested").mmenu({ 229 "extensions": [ 230 "pagedim-black" 231 ], 232 "counters": true, 233 "iconPanels": true 234 }); 235 });*/ 236 237 238 } 239} 240 241 242//================= 243//WIDGET INSTAGRAM 244//================== 245function Instagram() { 246 //version fr 247 if (jQuery('html:lang(fr-FR)').html()) { 248 jQuery('#sidebar2').find('.instagramWidget ul').before('<div class="title"></div><p>Vivez l\'aventure des fonds marins en images !</p>'); 249 } 250 251 //version en 252 if (jQuery('html:lang(en-US)').html()) { 253 jQuery('#sidebar2').find('.instagramWidget ul').before('<div class="title"></div><p>Experience the adventure of the seabed in images</p>'); 254 } 255 256 //version it 257 if (jQuery('html:lang(it-IT)').html()) { 258 jQuery('#sidebar2').find('.instagramWidget ul').before('<div class="title"></div><p>Experience the adventure of the seabed in images</p>'); 259 } 260 261 //version nl 262 if (jQuery('html:lang(nl-NL)').html()) { 263 jQuery('#sidebar2').find('.instagramWidget ul').before('<div class="title"></div><p>Experience the adventure of the seabed in images</p>'); 264 } 265 266 //version de 267 if (jQuery('html:lang(de-DE)').html()) { 268 jQuery('#sidebar2').find('.instagramWidget ul').before('<div class="title"></div><p>Experience the adventure of the seabed in images</p>'); 269 } 270} 271 272 273//================================= 274//AFFICHE BG MOBILE POUR EVENEMENT 275//=================================
276function updateBackgrounds() { 277 document.querySelectorAll('.eventSingle').forEach(function (div) { 278 var desktopBg = div.getAttribute('data-bg'); 279 var mobileBg = div.getAttribute('data-mobile-bg'); 280 if (window.innerWidth < 995) { 281 div.style.backgroundImage = 'url(' + mobileBg + ')'; 282 } else { 283 div.style.backgroundImage = 'url(' + desktopBg + ')'; // Restaure l'image principale 284 } 285 }); 286} 287 288// Appelle la fonction au chargement de la page et lors du redimensionnement de la fenêtre 289window.addEventListener('load', updateBackgrounds); 290window.addEventListener('resize', updateBackgrounds); 291 292 293//========================= 294//OWL CAROUSSEL - BON PLAN 295//========================= 296function CarrouselBonplan() { 297 298 var options = { 299 nav: false,// Show next and prev buttons 300 dots: false, 301 smartSpeed: 300, 302 autoplay: true, 303 dotsSpeed: 400, 304 loop: false, 305 items: 1 306 }; 307 if (jQuery('#planSlider .item').length > 1) { 308 options.loop = true; 309 } 310 jQuery('#planSlider').owlCarousel(options); 311 312} 313//========================= 314//OWL CAROUSSEL - ESPACE 315//========================= 316 317 318function CarrouselEspace() { 319 var options = { 320 nav: true, 321 dots: false, 322 smartSpeed: 300, 323 autoplay: false, 324 dotsSpeed: 400, 325 loop: false, 326 responsive: { 327 0: { 328 items: 1, // Pour les mobiles 329 }, 330 580: { 331 items: 2, 332 }, 333 850: { 334 items: 3, // Pour les tablettes 335 }, 336 1100: { 337 items: 4, 338 }, 339 1380: { 340 items: 5 // Pour les écrans larges 341 } 342 } 343 }; 344 345 // Initialiser le slider 346 jQuery('#sliderEspace .espace').owlCarousel(options); 347} 348 349// Appeler la fonction lorsque le document est prêt 350jQuery(document).ready(function () { 351 CarrouselEspace(); // Appel de la fonction pour initialiser le slider 352}); 353 354 355 356//========================= 357//OWL CAROUSSEL - ACTUALITE 358//========================= 359function CarrouselActu() { 360 361 var options = { 362 nav: false,// Show next and prev buttons 363 dots: false, 364 margin: 2, 365 smartSpeed: 300, 366 autoplay: false, 367 dotsSpeed: 400, 368 loop: true, 369 items: 1 370 }; 371 if (jQuery('#NewsCarrousel .post').length > 1) { 372 options.nav = true; 373 options.navText = ['<img alt="precedent" src="https://www.citedelamer.com/wp-content/themes/citedelamer2019/library/images/svg/element/arrow-left-blanc.svg"/>', '<img alt="suivant" src="https://www.citedelamer.com/wp-content/themes/citedelamer2019/library/images/svg/element/arrow-right-blanc.svg" />']; 374 } 375 jQuery('#NewsCarrousel').owlCarousel(options); 376 377} 378 379 380//================= 381//OWL CAROUSSEL 382//================== 383function Carousel() { 384 385 var options = { 386 nav: false,// Show next and prev buttons 387 dots: false, 388 smartSpeed: 300, 389 autoplay: false, 390 dotsSpeed: 400, 391 items: 1 392 }; 393 if (jQuery('#owl-pano .item').length > 1) { 394 options.dots = true; 395 } 396 jQuery('#owl-pano').owlCarousel(options); 397 398 399} 400 401 402 403// function CarouselEvent() { 404// var options = { 405// nav: false, // Show next and prev buttons 406// dots: false, 407// smartSpeed: 300, 408// autoplay: false, 409// dotsSpeed: 400, 410// items: 1 411// }; 412 413// if (jQuery('#slider-event .item').length > 1) { 414// options.dots = true; 415// } 416 417// jQuery('#slider-event').owlCarousel(options); 418// } 419 420// jQuery(document).ready(function() { 421// Carousel(); // Appel de la fonction pour initialiser le slider 422// }); 423 424 425//===================== 426//SLIDER EVENEMENT - PAGE 427//===================== 428 429jQuery(document).ready(function () { 430 var itemCount = jQuery('#slider-event-page .eventSingle').length; // Compter le nombre d'articles 431 432 if (itemCount > 1) { 433 jQuery('#slider-event-page').owlCarousel({ 434 items: 1, // Nombre d'éléments à afficher 435 stagePadding: 32, 436 loop: true, 437 margin: 10, 438 nav: true, 439 dots: false, 440 }); 441 } else { 442 // Si un seul élément, le rendre visible sans slider 443 jQuery('#slider-event-page').css('display', 'block'); // Assurez-vous qu'il est visible 444 } 445}); 446 447 448//===================== 449//GALERIE IMAGE - PAGE 450//===================== 451 452function CarrouselGalery() { 453 var $gallery = jQuery('.galery-photo-page'); 454 var itemCount = $gallery.find('.item').length; // Compter le nombre d'éléments 455 456 var options = { 457 nav: itemCount > 2, // Activer les flèches seulement si plus de 2 images 458 dots: false, 459 smartSpeed: 300, 460 autoplay: false, 461 dotsSpeed: 400, 462 loop: false, 463 responsive: { 464 0: { 465 items: 1, // Pour les mobiles 466 nav: false, 467 autoplay: true 468 }, 469 600: { 470 items: 2, 471 nav: false, 472 autoplay: true 473 }, 474 1000: { 475 items: 2 // Pour les écrans larges 476 } 477 } 478 }; 479 480 // // Activer le loop seulement si plus d'un élément 481 // if (itemCount > 2) { 482 // options.loop = true; 483 // } 484 485 // Initialiser le slider 486 $gallery.owlCarousel(options); 487} 488 489// Appeler la fonction lorsque le document est prêt 490jQuery(document).ready(function () { 491 CarrouselGalery(); // Appel de la fonction pour initialiser le slider 492}); 493 494// jQuery(document).ready(function() { 495// jQuery('#owl-inner-galery').owlCarousel({ 496// items: 3, // Nombre d'éléments à afficher 497// stagePadding: 32, 498// loop:true, 499// margin:10, 500// nav:true, 501// dots : false, 502// }); 503// }); 504 505 506//===================================== 507//GALERIE IMAGE - FOOTER - PARTENAIRE 508//===================================== 509 510function CarrouselFooterGallery() { 511 var options = { 512 loop: true, 513 autoplay: true, 514 margin: 10, 515 nav: false, 516 dots: false, 517 stagePadding: 32, 518 519 responsive: { 520 0: { 521 items: 2 // Pour les mobiles 522 }, 523 600: { 524 items: 3 // Pour les tablettes 525 }, 526 1000: { 527 items: 6 // Pour les écrans larges 528 } 529 } 530 }; 531 532 // Initialiser le slider 533 jQuery('#owl-inner-galery-footer').owlCarousel(options); 534} 535 536// Appeler la fonction lorsque le document est prêt 537jQuery(document).ready(function () { 538 CarrouselFooterGallery(); // Appel de la fonction pour initialiser le slider 539}); 540 541 542//===================================== 543// SLIDER PARTENAIRE - PAGE 544//===================================== 545 546function CarrouselPartenairey() { 547 var options = { 548 loop: true, 549 autoplay: true, 550 margin: 10, 551 nav: false, 552 dots: false, 553 responsive: { 554 0: { 555 items: 2, 556 nav: true, 557 autoplay: false, 558 }, 559 500: { 560 items: 3, 561 nav: true, 562 autoplay: false, 563 }, 564 650: { 565 items: 5, // Pour les mobiles 566 nav: true, 567 autoplay: false, 568 }, 569 800: { 570 items: 6 // Pour les tablettes 571 }, 572 1000: { 573 items: 7 // Pour les écrans larges 574 } 575 } 576 }; 577 578 // Initialiser le slider 579 jQuery('#partenaireLogoSlide').owlCarousel(options); 580} 581 582// Appeler la fonction lorsque le document est prêt 583jQuery(document).ready(function () { 584 CarrouselPartenairey(); // Appel de la fonction pour initialiser le slider 585}); 586 587 588 589//================= 590//OWL CAROUSSEL 591//================== 592function CarouselInner() { 593 594 var options = { 595 nav: false,// Show next and prev buttons 596 dots: false, 597 smartSpeed: 300, 598 autoplay: false, 599 dotsSpeed: 400, 600 items: 1 601 };
602 if (jQuery('#owl-inner .item').length > 1) { 603 options.dots = true; 604 } 605 jQuery('#owl-inner').owlCarousel(options); 606 607 608} 609 610function CarouselInnerSecond() { 611 612 var options = { 613 nav: false,// Show next and prev buttons 614 dots: false, 615 smartSpeed: 300, 616 autoplay: false, 617 dotsSpeed: 400, 618 items: 1 619 }; 620 if (jQuery('#owl-inner-second .item').length > 1) { 621 options.dots = true; 622 } 623 jQuery('#owl-inner-second').owlCarousel(options); 624 625 626} 627 628 629 630//================================ 631//OWL CAROUSSEL VIDEO + MINIATURE 632//================================ 633function CarouselVideo() { 634 //Condition pour loop 635 var options = { 636 items: 1, 637 dots: false, 638 loop: false, 639 video: true, 640 lazyLoad: true, 641 center: true 642 }; 643 if (jQuery('#carrousel-video .item-video').length > 1) { 644 options.loop = true; 645 options.dots = true; 646 } 647 jQuery('#carrousel-video').owlCarousel(options); 648 649 650 jQuery('#carrousel-video').each(function () { 651 652 //MODIFICATION DU DOT 653 // 1) ASSIGN EACH 'DOT' A NUMBER 654 dotcount = 1; 655 jQuery('.owl-dot', this).each(function () { 656 jQuery(this).addClass('dotnumber' + dotcount); 657 jQuery(this).attr('data-info', dotcount); 658 dotcount = dotcount + 1; 659 }); 660 661 // 2) ASSIGN EACH 'SLIDE' A NUMBER 662 slidecount = 1 663 jQuery('.owl-item .item-video', this).each(function () { 664 if (jQuery(this).parent('.fixed-video-aspect').parent('.owl-item').hasClass('cloned')) { 665 //console.log('toto'); 666 } 667 else { 668 //console.log(slidecount); 669 jQuery(this).addClass('slidenumber' + slidecount); 670 slidecount = slidecount + 1; 671 672 } 673 }); 674 675 // SYNC THE SLIDE NUMBER IMG TO ITS DOT COUNTERPART (E.G SLIDE 1 IMG TO DOT 1 BACKGROUND-IMAGE) 676 jQuery('.owl-dot', this).each(function () { 677 grab = jQuery(this).data('info'); 678 slidegrab = jQuery('.slidenumber' + grab + ' .owl-video-tn').attr('data-src'); 679 //console.log(slidegrab); 680 681 // jQuery(this).css("background-image", "url("+slidegrab+")"); 682 jQuery(this).html('<img src="' + slidegrab + '"/>'); 683 684 }); 685 686 // THIS FINAL BIT CAN BE REMOVED AND OVERRIDEN WITH YOUR OWN CSS OR FUNCTION, I JUST HAVE IT 687 // TO MAKE IT ALL NEAT 688 amount = jQuery('.owl-dot').length; 689 //gotowidth = 100/amount; 690 gotowidth = 16.66667; 691 692 jQuery('.owl-dot', this).css("width", gotowidth + "%"); 693 newwidth = jQuery('.owl-dot', this).width(); 694 newwidth = newwidth + 2; 695 jQuery('.owl-dot', this).css("height", newwidth + "px"); 696 697 698 }); 699 700} 701 702 703 704//================================ 705//OWL CAROUSSEL VIDEO + MINIATURE 706//================================ 707function CarouselVideoMain() { 708 //Condition pour loop 709 var options = { 710 items: 1, 711 dots: false, 712 loop: false, 713 video: true, 714 lazyLoad: true, 715 center: true 716 };
717 if (jQuery('#carrousel-video-main .item-video').length > 1) { 718 options.loop = true; 719 options.dots = true; 720 } 721 jQuery('#carrousel-video-main').owlCarousel(options); 722 723 724 jQuery('#carrousel-video-main').each(function () { 725 726 //MODIFICATION DU DOT 727 // 1) ASSIGN EACH 'DOT' A NUMBER 728 dotcount = 1; 729 jQuery('.owl-dot', this).each(function () { 730 jQuery(this).addClass('dotnumber' + dotcount); 731 jQuery(this).attr('data-info', dotcount); 732 dotcount = dotcount + 1; 733 }); 734 735 // 2) ASSIGN EACH 'SLIDE' A NUMBER 736 slidecount = 1 737 jQuery('.owl-item .item-video', this).each(function () { 738 if (jQuery(this).parent('.fixed-video-aspect').parent('.owl-item').hasClass('cloned')) { 739 //console.log('toto'); 740 } 741 else { 742 //console.log(slidecount); 743 jQuery(this).addClass('slidenumber' + slidecount); 744 slidecount = slidecount + 1; 745 746 } 747 }); 748 749 // SYNC THE SLIDE NUMBER IMG TO ITS DOT COUNTERPART (E.G SLIDE 1 IMG TO DOT 1 BACKGROUND-IMAGE) 750 jQuery('.owl-dot', this).each(function () { 751 grab = jQuery(this).data('info'); 752 slidegrab = jQuery('.slidenumber' + grab + ' .owl-video-tn').attr('data-src'); 753 //console.log(slidegrab); 754 755 // jQuery(this).css("background-image", "url("+slidegrab+")"); 756 jQuery(this).html('<img src="' + slidegrab + '"/>'); 757 758 }); 759 760 // THIS FINAL BIT CAN BE REMOVED AND OVERRIDEN WITH YOUR OWN CSS OR FUNCTION, I JUST HAVE IT 761 // TO MAKE IT ALL NEAT 762 amount = jQuery('.owl-dot').length; 763 //gotowidth = 100/amount; 764 gotowidth = 16.66667; 765 766 jQuery('.owl-dot', this).css("width", gotowidth + "%"); 767 newwidth = jQuery('.owl-dot', this).width(); 768 newwidth = newwidth + 2; 769 jQuery('.owl-dot', this).css("height", newwidth + "px"); 770 771 772 }); 773 774} 775 776//================== 777//OWL CAROUSSEL 778//================== 779function CarrouselDate() { 780 781 var options = { 782 nav: false,// Show next and prev buttons 783 dots: false, 784 smartSpeed: 300, 785 autoplay: false, 786 autoHeight: true, 787 //dotsSpeed : 400, 788 items: 1, 789 loop: false, 790 navText: ['<span class="arrow-left"></span>', '<span class="arrow-right"></span>'], 791 navRewind: false 792 }; 793 if (jQuery('#HoraireCalendrier .planning').length > 1) { 794 options.nav = true; 795 796 } 797 jQuery('#HoraireCalendrier .inside').owlCarousel(options); 798} 799 800 801 802//======================== 803//CHECKED ACCORDEON 804//======================== 805function Accordeon() { 806 //initialize 807 jQuery('.accordeon input').each(function () { 808 jQuery(this).prop('checked', true); 809 }); 810 //Action au clic 811 jQuery('.accordeon input').change(function () { 812 var ValueCheck = jQuery(this).prop('checked'); 813 //console.log(ValueCheck); 814 815 if (ValueCheck == false) { 816 jQuery('.accordeon input').prop('checked', true); 817 jQuery(this).prop('checked', false); 818 } else { 819 jQuery(this).prop('checked', true); 820 } 821 822 }); 823} 824 825 826//====================== 827//GALERIE PHOTO 828//====================== 829function Galerie() { 830 831 jQuery("#lightgallery").find('a:eq(0)').addClass('firstElement'); 832 //version fr 833 if (jQuery('html:lang(fr-FR)').html()) { 834 jQuery("#lightgallery").find('a:eq(0)').prepend('<span>Galerie</span><span class="glyph photo"></span>'); 835 } 836 837 838 jQuery("#lightgallery").lightGallery({ 839 download: false, 840 counter: false, 841 getCaptionFromTitleOrAlt: false, 842 thumbnail: true 843 }); 844} 845 846function GaleriePage() { 847 jQuery(".lightgallery").lightGallery({ 848 download: true, 849 counter: false, 850 subHtmlSelectorRelative: true, 851 getCaptionFromTitleOrAlt: true, 852 thumbnail: true 853 }); 854 855} 856 857 858//============================== 859//FONCTION SCROLL ON LOAD ANCHOR 860//============================== 861function ScrollAnchor() { 862 // to top right away 863 if (window.location.hash) scroll(0, 0); 864 // void some browsers issue 865 setTimeout(function () { scroll(0, 0); }, 1); 866 867 jQuery(function () { 868 // your current click function 869 jQuery('#anchor a').on('click', function (e) { 870 871 e.preventDefault(); 872 jQuery('html, body').animate({ 873 scrollTop: jQuery(jQuery(this).attr('href')).offset().top - 180 874 }, 800, 'swing'); 875 }); 876 jQuery('.goto').on('click', function (e) { 877 878 e.preventDefault(); 879 jQuery('html, body').animate({ 880 scrollTop: jQuery(jQuery(this).attr('href')).offset().top - 180 881 }, 800, 'swing'); 882 }); 883 // *only* if we have anchor on the url 884 if (window.location.hash) {
885 // smooth scroll to the anchor id 886 jQuery('html, body').animate({ 887 scrollTop: jQuery(window.location.hash).offset().top - 180 888 }, 800, 'swing'); 889 } 890 }); 891} 892 893 894//============================== 895//FONCTION ONGLET TABLEAU 896//============================== 897function Onglet() { 898 jQuery('.tabs-container').each(function () { 899 //var _tc = jQuery('.tabs-container'); 900 var _tc = jQuery(this); 901 var _ts = _tc.find('.tabs', this); 902 var _cs = _tc.find('.contents', this); 903 904 /* Calculate tabs' width 905 var l = _ts.find('span',this).length; 906 _ts.find('span').outerWidth( 100/l+'%' );*/ 907 908 /* Build active bar */ 909 _ts.append('<span class="active-bar" />'); 910 var _bar = _ts.find('.active-bar', this); 911 912 function setActive(index) { 913 _ts.find('span') 914 .eq(index) 915 .addClass('active') 916 .siblings() 917 .removeClass('active'); 918 _cs.find('article') 919 .eq(index) 920 .addClass('active') 921 .fadeIn(300) 922 .siblings() 923 .removeClass('active') 924 .hide(); 925 926 var wid = _ts.find('span').eq(index).outerWidth(); 927 _bar.width(wid); 928 } 929 930 _ts.on('click', 'span', function () { 931 var _active = jQuery(this); 932 var getLft = _active.position().left; 933 var getWid = _active.outerWidth(); 934 935 setActive(_active.index()); 936 937 _bar.animate({ 938 left: getLft, 939 width: getWid, 940 }, 300); 941 }); 942 943 setActive(0); 944 }); 945} 946 947//======================================== 948//Shortcut -> effet hover + clic sur touch 949//======================================== 950function Shortcut() { 951 952 //if(jQuery(window).width() > 767) { 953 if (Modernizr.touch) { 954 jQuery('.shortcuts .raccourci').each(function () { 955 jQuery('a', this).attr('href', 'javascript:;'); //suppresion du lien 956 957 var Links = jQuery('a', this).attr('data-href'); 958 959 //function touchstart 960 jQuery(this).bind('touchstart', function () { 961 //console.log('TouchStart'); 962 //window.location.href = "Links"; 963 964 //Test du click 965 if (jQuery(this).hasClass('hover')) { 966 window.location.href = Links; 967 //alert('toto'); 968 } else { 969 jQuery('.shortcuts .raccourci').removeClass('hover'); 970 jQuery(this).addClass('hover'); 971 var timeTouched = 1; 972 } 973 974 }); 975 }); 976 977 978 } else { 979 //alert('No Touch Screen'); 980 } 981 982 983 984} 985 986//==================== 987//iFrame Embed 988//==================== 989/*function embedContent(){ 990 jQuery('#content iframe').wrap('<div class="embed-container" />'); 991} 992*/ 993 994//============================ 995//LIGHTBOX VIDEO 996//============================ 997function LightBoxVideo() { 998 999 var glissiere = jQuery('.lightbox'); 1000 1001 //ouverture de la glissiere 1002 jQuery('.videoLight').bind("click", function (e) { 1003 1004 var Frame = jQuery(this).attr('data-video'); 1005 //console.log(Frame); 1006 glissiere.addClass("active"); 1007 jQuery('body').addClass('overflow-hidden'); 1008 //glissiere.css('display','block');//apparation glissiere 1009 //remplissage iframe 1010 jQuery('#contentGlissiere').html('<div class="embed-container"><iframe width="1280" height="720" src="https://www.youtube.com/embed/' + Frame + '?rel=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div>'); 1011 1012 1013 1014 1015 }); 1016 1017 1018 1019 //fonction de fermeture de glissiere 1020 jQuery('.lightbox .close').bind("click", function (e) { 1021 jQuery(this).parents('.lightbox').animate({ 1022 //height: '0' 1023 }, 200, function () { 1024 jQuery('#contentGlissiere').html(''); 1025 jQuery(this).removeClass('active'); 1026 jQuery('body').removeClass('overflow-hidden'); 1027 1028 }); 1029 }); 1030 1031 jQuery('.lightbox').bind("click", function (e) { 1032 jQuery(this).animate({ 1033 //height: '0' 1034 }, 200, function () { 1035 jQuery('#contentGlissiere').html(''); 1036 jQuery(this).removeClass('active'); 1037 jQuery('body').removeClass('overflow-hidden'); 1038 }); 1039 }); 1040 1041 1042} 1043 1044/** 1045 * Gestion navigation dans jquery ui tabs 1046 * @changlog 2017-06-01 (Adrien) 1047 */ 1048function manageJqueryTabsNav() { 1049 //si pas ui-accordion-header 1050 if (jQuery(".ui-accordion-header").lenght == 0) { 1051 return false; 1052 } 1053 1054 //hash 1055 var hash = window.location.hash; 1056 if (hash == "") { 1057 return false; 1058 } 1059 1060 hash = hash.replace("#", ""); 1061 1062 //cible 1063 var $btnCible = jQuery(".slug-" + hash); 1064 1065 console.log("on : " + ".slug-" + hash); 1066 1067 //deployed 1068 $btnCible.click(); 1069 1070 //scroll to 1071 setTimeout(function () { 1072 jQuery('html, body').animate( 1073 { 1074 scrollTop: $btnCible.offset().top 1075 }, 1); 1076 }, 300); 1077 1078 setTimeout(function () { 1079 jQuery('html, body').animate( 1080 { 1081 scrollTop: $btnCible.offset().top 1082 }, 1); 1083 }, 500); 1084 1085} 1086 1087 1088//====================== 1089//PARALLAX HOME EFFECT 1090//====================== 1091// function ParallaxEffect(){ 1092 1093// if( jQuery('html:lang(fr-FR)').html() ){ 1094// var windowsTop = jQuery(window).scrollTop();//Position windows 1095// var eTop = jQuery('#bottomHome').offset().top; //Position du conteneur principal 1096// var scrolled = eTop - windowsTop ; //Calcul 1097 1098// var scrolledPlan = scrolled*0.25; //Vitesse de defilement bon plan 1099// var scrolledActu = scrolled*0.25; //Vitesse de defilement bon plan 1100// var scrolledNewsLetter = scrolled/0.0025; //Vitesse de defilement bon plan 1101 1102// if(scrolled > 0){//Condition pour le lancement de l'effet Parallalax 1103// jQuery('#bottomHome .bonplan').css({'transform':'translateY('+scrolledPlan+'px)'}); 1104// jQuery('#bottomHome .actu').css({'transform':'translateY('+scrolledActu+'px)'}); 1105// jQuery('#bottomHome .newsletterWidget').css({'transform':'translateY('+scrolledActu+'px)'}); 1106// }else{//Arrêt du parallalax 1107// jQuery('#bottomHome .bonplan').css({'transform':'translateY(0px)'}); 1108// jQuery('#bottomHome .actu').css({'transform':'translateY(0px)'}); 1109// jQuery('#bottomHome .newsletterWidget').css({'transform':'translateY(0px)'}); 1110// } 1111// } 1112 1113// } 1114 1115 1116//==================== 1117//HIDE HEADER 1118//==================== 1119function HideHeader() { 1120 1121 // Hide Header on on scroll down 1122 var didScroll; 1123 var lastScrollTop = 0; 1124 var delta = 2; 1125 var navbarHeight = jQuery('#header').outerHeight(); 1126 1127 1128 jQuery(window).scroll(function (event) { 1129 didScroll = true; 1130 }); 1131 setInterval(function () { 1132 if (didScroll) { 1133 hasScrolled(); 1134 didScroll = false;
1135 1136 var st = jQuery(this).scrollTop(); 1137 if (st == 0) { 1138 jQuery('#header').removeClass('hide'); 1139 } 1140 //console.log(st); 1141 } 1142 }, 250); 1143 1144 function hasScrolled() { 1145 var st = jQuery(this).scrollTop(); 1146 // Make sure they scroll more than delta 1147 if (Math.abs(lastScrollTop - st) <= delta) 1148 return; 1149 1150 // If they scrolled down and are past the navbar, add class .nav-up. 1151 // This is necessary so you never see what is "behind" the navbar. 1152 if (st > lastScrollTop && st > navbarHeight) { 1153 // Scroll Down 1154 jQuery('#header').addClass('hide'); 1155 } else { 1156 // Scroll Up 1157 if (st + jQuery(window).height() < jQuery(document).height()) { 1158 jQuery('#header').removeClass('hide'); 1159 } 1160 } 1161 lastScrollTop = st; 1162 } 1163 1164} 1165 1166 1167//==================== 1168//HIDE HEADER 1169//==================== 1170function StickyWidget() { 1171 1172 if (jQuery('.Zonetop .col .widget').html()) { 1173 1174 jQuery(".Zonetop .col .widget").stick_in_parent() 1175 .on("sticky_kit:stick", function (e) { 1176 //console.log('stick'); 1177 jQuery(this).css({ 'transform': 'translateY(10px)' }); 1178 }) 1179 .on("sticky_kit:unstick", function (e) { 1180 //console.log('unstick'); 1181 jQuery(this).css({ 'transform': 'translateY(-80px)' }); 1182 }) 1183 .on("sticky_kit:bottom", function (e) { 1184 //console.log('bottom'); 1185 jQuery(this).css({ 'transform': 'translateY(-80px)' }); 1186 }) 1187 .on("sticky_kit:unbottom", function (e) { 1188 //console.log('unbottom'); 1189 jQuery(this).css({ 'transform': 'translateY(140px)' }); 1190 }); 1191 1192 } 1193 1194 1195 if (jQuery('.ZoneBottom .col .widget').html()) { 1196 1197 jQuery(".ZoneBottom .col .widget").stick_in_parent() 1198 .on("sticky_kit:stick", function (e) { 1199 //console.log('stick'); 1200 jQuery(this).css({ 'transform': 'translateY(10px)' }); 1201 }) 1202 .on("sticky_kit:unstick", function (e) { 1203 //console.log('unstick'); 1204 jQuery(this).css({ 'transform': 'translateY(0px)' }); 1205 }) 1206 .on("sticky_kit:bottom", function (e) { 1207 //console.log('bottom'); 1208 jQuery(this).css({ 'transform': 'translateY(-40px)' }); 1209 }) 1210 .on("sticky_kit:unbottom", function (e) { 1211 //console.log('unbottom'); 1212 jQuery(this).css({ 'transform': 'translateY(140px)' }); 1213 }); 1214 1215 } 1216} 1217 1218//@changelog 2025-04-16 [EVOL] (Antso) animate eventSingle (202504150008) 1219//animate eventSingle 1220function animateEventSingle() { 1221 const events = jQuery('.espaceEvent .eventSingle'); 1222 const scroll = window.scrollY; 1223 const windowHeight = window.innerHeight; 1224 1225 events.each(function (index) { 1226 const $el = jQuery(this); 1227 const elOffsetTop = $el.offset().top; 1228 const elHeight = $el.outerHeight(); 1229 1230 // How far the element is from the top of the viewport 1231 const distanceFromTop = elOffsetTop - scroll; 1232 1233 // When the element is in the top 90% of the viewport 1234 if (distanceFromTop < windowHeight * 0.9 && distanceFromTop + elHeight > 0) { 1235 // How much of the element is within the top part of the viewport 1236 let visibleRatio = 1 - (distanceFromTop / (windowHeight * 0.9)); 1237 visibleRatio = Math.min(Math.max(visibleRatio, 0), 1); // Clamp between 0 and 1 1238 1239 // Shrink from 1 to 0.8 as it scrolls in 1240 let scale = 1 - (0.2 * visibleRatio); 1241 1242 // Reverse index so newer elements get higher z-index 1243 const zIndex = 10 + index; 1244 1245 $el.css({ 1246 'transform': `scale(${scale})`, 1247 'z-index': zIndex 1248 }); 1249 } else { 1250 // Reset for elements far out of view 1251 $el.css({ 1252 'transform': 'scale(1)', 1253 'z-index': 1 1254 }); 1255 } 1256 }); 1257} 1258 1259 1260 1261//======================================= 1262// Put all your regular jQuery in here.// 1263//======================================= 1264var entering = true; 1265jQuery(document).ready(function ($) { 1266 1267 1268 Navigation(); 1269 Instagram(); 1270 HeaderActive(); 1271 //embedContent(); 1272 1273 SVGinline(); 1274 loadBackGround(); 1275 1276 1277 1278 //Page Accueil 1279 // if($('#HomepageTemplate').html()){ 1280 // LightBoxVideo(); 1281 // CarrouselActu(); 1282 // CarrouselBonplan(); 1283 // Shortcut();//comportement pour ecran touch; 1284 // ScrollAnchor(); 1285 1286 // if(jQuery(window).width() > 767) {//BIG SCREEN 1287 // $(window).scroll(function (e) { 1288 // ParallaxEffect(); 1289 // }); 1290 // } 1291 1292 // } 1293 1294 //Page espace 1295 if ($('body.page-template-espace-detail').html()) { 1296 1297 Carousel(); 1298 1299 if ($('#owl-inner').html()) { 1300 CarouselInner(); 1301 } 1302 if ($('#owl-inner-second').html()) { 1303 CarouselInnerSecond(); 1304 } 1305 if ($('#carrousel-video-main').html()) { 1306 CarouselVideoMain(); 1307 } 1308 if ($('#carrousel-video').html()) { 1309 CarouselVideo(); 1310 } 1311 Galerie(); 1312 1313 //loadBackGround(); 1314 } 1315 if ($('body.page-template-espace-detail2019').html()) { 1316 1317 if (jQuery(window).width() > 980) { 1318 HideHeader(); 1319 StickyWidget(); 1320 } 1321 1322 1323 1324 /** 1325 * @changelog 2019-04-11 (Adrien) gestion du scroll page d'accueil 1326 */ 1327 if ($('body.page-id-205118').length > 0) { 1328 //COPIE DE SCRIPT TEST 1329 //citedelamer2019/library/js/doublePanel.js 1330 } 1331 1332 1333 1334 } 1335 1336 1337 //Widget accordeon 1338 if ($('.accordeon').html()) { 1339 Accordeon(); 1340 } 1341 //Ancre interne/externe 1342 if ($('#anchor').html()) { 1343 ScrollAnchor(); 1344 } 1345 //Tableau avec onglet 1346 if ($('.tabs-container').html()) { 1347 Onglet(); 1348 } 1349 //Galerie photo inner 1350 if ($('.lightgallery').html()) { 1351 GaleriePage(); 1352 } 1353 1354 //Carroussel Calendrier 1355 if ($('#HoraireCalendrier').html()) { 1356 CarrouselDate(); 1357 } 1358 1359 1360 //@changlog 2017-06-01 (Adrien) Gestion navigation dans jquery ui tabs 1361 manageJqueryTabsNav(); 1362 1363 1364 jQuery(window).scroll(function () { 1365 animateEventSingle(); 1366 }); 1367 animateEventSingle(); 1368 1369}
1369); /* end of as page load scripts */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.