Skip to content

Commit fa01931

Browse files
author
Karl Swedberg
committed
added a safeguard to the scrollTarget value
1 parent abb6711 commit fa01931

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jquery.smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ $.smoothScroll = function(options, px) {
7373
scrollTargetOffset = options;
7474
} else {
7575
opts = $.extend({}, $.fn.smoothScroll.defaults, options);
76-
scrollTargetOffset = px || $(opts.scrollTarget).offset().top;
76+
scrollTargetOffset = px || $(opts.scrollTarget).offset() && $(opts.scrollTarget).offset().top || 0;
7777
}
7878
opts = $.extend({link: null}, opts);
7979

0 commit comments

Comments
 (0)