prevent syntax error when invalid hash is given
Costa Tsaousis (ktsaou) committed
Oct 6, 2016 at 20:42 UTC
8865b8f05e29c737a7ac69dc806a2a119899fdff
1 file changed
+1
-1
web/index.html
+1
-1
@@ -915,7 +915,7 @@
915
// scroll to a section, without changing the browser history
916
917
function scrollToId(hash) {
918
- if(hash && hash != '') {
918
+ if(hash && hash != '' && document.getElementById(hash) !== null) {
919
var offset = $('#' + hash).offset();
920
if(typeof offset !== 'undefined')
921
$('html, body').animate({ scrollTop: offset.top }, 0);