(function($) { "use strict" /* //disclaimer cookies var css_disclaimer_cookie = ' style="display:none; position:fixed; bottom:0; left:0; width:100%; padding:40px 10px; z-index:99999999; background:#333; color:#fff; font-size:16px;" '; var css_disclaimer_cookie_button_ok = ' style="display:inline-block; padding: 20px; margin-left:30px; background:#fff; color:#000; font-size:16px;" '; var css_disclaimer_cookie_link_normal = ' style="color:#fff; font-size:16px; text-decoration:underline;" '; if (getCookie('WG_disclaimer_cookies') == '') { $("body").append( '
' ); $(".disclaimer_cookie").show(); } */ /* $(".liensOnepage").on("click", function() { var el = $(this).attr('href'); var height = $(el)[0].offsetTop - 120; $('html, body').animate({ scrollTop: height }, 800); if ($('.navbar-toggle').css('display') != 'none') { if (!$('.navbar-toggle').hasClass('collapsed')) { $('.navbar-toggle').trigger("click"); } } }); */ //Page Preloader $(window).load(function() { if (window.location.pathname.includes("actualite-du-mois")) { $('#menu-main li:nth-child(7)').addClass("active") } $("#intro").delay(300).fadeOut(); $(".animationload").delay(600).fadeOut("slow"); }); // FitDiv $("body").fitVids(); // Tooltips // $('.social, .media_element, .bs-example-tooltips').tooltip({ // selector: "[data-toggle=tooltip]", // container: "body" // }) // DM Menu jQuery('.header').affix({ offset: { top: $('.header').offset().top } }); // Menu drop down effect $('.dropdown-toggle').dropdownHover().dropdown(); $(document).on('click', '.fhmm .dropdown-menu', function(e) { e.stopPropagation() }) //pretty photo jQuery(document).ready(function(){ jQuery("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'dark_rounded',slideshow:false,overlay_gallery: false,social_tools:false,deeplinking:false}); }); // Fun Facts function count($this){ var current = parseInt($this.html(), 10); current = current + 1; /* Where 50 is increment */ $this.html(++current); if(current > $this.data('count')){ $this.html($this.data('count')); } else { setTimeout(function(){count($this)}, 50); } } $(".stat-count").each(function() { $(this).data('count', parseInt($(this).html(), 10)); $(this).html('0'); count($(this)); }); //Parallax $(window).bind('load', function() { parallaxInit(); }); function parallaxInit() { $('#one-parallax').parallax("30%", 0.1); $('#two-parallax').parallax("30%", 0.1); $('#three-parallax').parallax("30%", 0.1); $('#four-parallax').parallax("30%", 0.1); } // Search var $ctsearch = $( '#dmsearch' ), $ctsearchinput = $ctsearch.find('input.dmsearch-input'), $body = $('html,body'), openSearch = function() { $ctsearch.data('open',true).addClass('dmsearch-open'); $ctsearchinput.focus(); return false; }, closeSearch = function() { $ctsearch.data('open',false).removeClass('dmsearch-open'); }; $ctsearchinput.on('click',function(e) { e.stopPropagation(); $ctsearch.data('open',true); }); $ctsearch.on('click',function(e) { e.stopPropagation(); if( !$ctsearch.data('open') ) { openSearch(); $body.off( 'click' ).on( 'click', function(e) { closeSearch(); } ); } else { if( $ctsearchinput.val() === '' ) { closeSearch(); return false; } } }); // Selector $(window).on('load', function () { $('.selectpicker').selectpicker({ 'selectedText': 'cat' }); }); // Back to Top jQuery(window).scroll(function(){ if (jQuery(this).scrollTop() > 1) { jQuery('.dmtop').css({bottom:"25px"}); } else { jQuery('.dmtop').css({bottom:"-100px"}); } }); jQuery('.dmtop').click(function(){ jQuery('html, body').animate({scrollTop: '0px'}, 800); return false; }); // Smooth scroll pour les ancres OnePage (géré proprement pour éviter les sauts) // $(document).on('click', '.liensOnepage', function (e) { // // Si un autre handler (ex: listener en phase capture) a déjà appelé preventDefault(), // // on ne doit pas lancer un second scroll — évite le double-scroll/conflict. // if (e && typeof e.isDefaultPrevented === 'function' && e.isDefaultPrevented()) { // return; // } // // // Si un smooth scroll est déjà en cours, on ne lance pas un nouveau. // if (window.isSmoothScrolling) { // return; // } // // var href = $(this).attr('href') || ''; // var hashIndex = href.indexOf('#'); // if (hashIndex === -1) { // // pas d'ancre, comportement par défaut // return; // } // // var anchor = href.substring(hashIndex); // // Si l'ancre n'existe pas dans la page, laisser le comportement par défaut // var $target = $(anchor); // if ($target.length === 0) { // return; // } // // // Empêcher navigation par défaut et effectuer un scroll animé // e.preventDefault(); // // var headerHeight = 0; // var $topHeader = $('#top-header'); // if ($topHeader.length) { // headerHeight = $topHeader.outerHeight(); // } // // var offset = Math.max(0, $target.offset().top - headerHeight - 10); // // // Indicateur pour les autres handlers (ex: le handler qui masque le header) // window.isSmoothScrolling = true; // // // Stopper d'éventuelles animations en cours et lancer la nouvelle // $('html, body').stop().animate({ // scrollTop: offset // }, 600, function () { // // Mettre à jour proprement le hash sans provoquer de saut // try { // if (window.history && history.replaceState) { // history.replaceState(null, '', anchor); // } else { // // fallback (peut provoquer un saut chez certains navigateurs mais rarement) // location.hash = anchor; // } // } catch (e) { // // ignore // } // // // Laisser un court délai puis autoriser à nouveau les handlers de scroll // setTimeout(function () { // window.isSmoothScrolling = false; // }, 60); // }); // // // Si menu mobile, fermer le menu après clic // if ($('.navbar-toggle').css('display') != 'none') { // if (!$('.navbar-toggle').hasClass('collapsed')) { // $('.navbar-toggle').trigger('click'); // } // } // }); })(jQuery);