diff --git a/themes/project/layouts/partials/scripts.html b/themes/project/layouts/partials/scripts.html index 39730a67ba337c0ab1953a9a331c2126181b8b28..d44fbecd2e7b9677370a2c2eba4713cb203b33c6 100644 --- a/themes/project/layouts/partials/scripts.html +++ b/themes/project/layouts/partials/scripts.html @@ -143,5 +143,17 @@ showNav(); } }); + $(' a[href^="#"][href!="#"]').click(function () { + var target = document.getElementById(decodeURI(this.hash).split('#')[1]); + if (!target) { + return; + } + var targetOffset = $(target).offset().top - 140 + 'px'; + $('html,body').animate({ + scrollTop: targetOffset + }, + 300); + return false; + }); }); \ No newline at end of file