diff options
author | Derek Severin <severinderek@gmail.com> | 2021-10-30 12:56:15 +0300 |
---|---|---|
committer | Derek Severin <severinderek@gmail.com> | 2021-10-30 12:56:15 +0300 |
commit | 2273faae6d891a626515cba59193ff761763babd (patch) | |
tree | 67ba22c0db2fa80eddbeff21ae2f705a43679656 | |
parent | 31ecf34e1782b776ce269b776052dc4df3b6c382 (diff) |
Home scroll fix
-rw-r--r-- | static/js/theme.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/static/js/theme.js b/static/js/theme.js index 878da05..9131c0e 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -10,10 +10,13 @@ // jQuery for page scrolling feature - requires jQuery Easing plugin $('a.page-scroll').bind('click', function(event) { var $anchor = $(this); - $('html, body').stop().animate({ - scrollTop: ($($anchor.attr('href')).offset().top - $('.navbar-header').height()) - }, 1250, 'easeInOutExpo'); - event.preventDefault(); + var $offset = $($anchor.attr('href')).offset(); + if ($offset) { + $('html, body').stop().animate({ + scrollTop: $offset.top - $('.navbar-header').height() + }, 1250, 'easeInOutExpo'); + event.preventDefault(); + } }); // Highlight the top nav as scrolling occurs |