; (function () { $('img[usemap]').rwdImageMaps(); onScroll(); setTimeout(function () { scrollToHashTag(); }, 1000); $('body').on('scroll', onScroll); $('[href]').on('click', function (e) { const href = $(this).attr('href'); if (href.indexOf('#') === -1) { return; } e.preventDefault(); $('html, body').animate({ scrollTop: $('body').scrollTop() + $(href).offset().top - 75 }, 1000); }); function onScroll() { const scrollTop = document.body.scrollTop; if (scrollTop > 20) { $('#header').addClass('is--sticky'); } else { $('#header').removeClass('is--sticky'); } } function scrollToHashTag() { const hash = window.location.hash; if (!hash || $(hash).length <= 0) { return; } $('html, body').animate({ scrollTop: $('body').scrollTop() + $(hash).offset().top - 75 }, 1000); }; })()