Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/2-REC/hugo-myportfolio-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Severin <severinderek@gmail.com>2021-10-30 12:56:15 +0300
committerDerek Severin <severinderek@gmail.com>2021-10-30 12:56:15 +0300
commit2273faae6d891a626515cba59193ff761763babd (patch)
tree67ba22c0db2fa80eddbeff21ae2f705a43679656
parent31ecf34e1782b776ce269b776052dc4df3b6c382 (diff)
Home scroll fix
-rw-r--r--static/js/theme.js11
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