diff options
Diffstat (limited to 'assets/js/script.js')
-rw-r--r-- | assets/js/script.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/assets/js/script.js b/assets/js/script.js index 7e7f1aa..9123063 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -69,13 +69,16 @@ $(document).ready(function () { // Smooth scrolling var scrollLink = $(".scroll"); scrollLink.click(function (e) { - e.preventDefault(); - $("body,html").animate( - { - scrollTop: $(this.hash).offset().top, - }, - 1000 - ); + let elem = $(this.hash) + if (elem.length) { + e.preventDefault(); + $("body,html").animate( + { + scrollTop: elem.offset().top, + }, + 1000 + ); + } }); $(".navbar-nav>li>a").on("click", function () { |