/* smooth scroll vers ancre au clic et au chargement de la page */ $(document).on('click','[href*="#"]',function() { var h = '#'+$(this).attr('href').split('#')[1]; if (h.indexOf('=')==-1 && $(h).length) { $('html,body').stop(true).animate({scrollTop:$(h).offset().top-$('header').height()-50},500); return false; } }); if (location.hash && $(location.hash).length) { window.scrollTo(0,0); $('html,body').stop(true).animate({scrollTop:$(location.hash).offset().top-$('header').height()-50},500); history.pushState({},'',location.href.split('#')[0]); return false; }