diff --git a/www/js/agency.js b/www/js/agency.js index 41fc9ca..2822679 100644 --- a/www/js/agency.js +++ b/www/js/agency.js @@ -2,13 +2,18 @@ "use strict"; // Start of use strict // Smooth scrolling using jQuery easing + let lastLength = null; $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function () { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); - if (target.length) { + if (target.length && lastLength !== target.length) { + lastLength = target.length; $('html, body').animate({ - scrollTop: (target.offset().top - 54) + scrollTop: (target.offset().top - 54), + complete: function () { + lastLength = null; + } }, 1000, "easeInOutExpo"); return false; }