From be28b785a19f8cd35dd0e0b33b5572cd18ac1d94 Mon Sep 17 00:00:00 2001 From: Robert Lord Date: Thu, 4 Dec 2014 15:41:08 -0800 Subject: [PATCH] Fix scrollIntoView undefined bug when there is no hash, fixes #114 Thanks to @kevin-buttercoin for this fix! --- source/javascripts/app/lang.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/javascripts/app/lang.js b/source/javascripts/app/lang.js index 6909f34..c59a16b 100644 --- a/source/javascripts/app/lang.js +++ b/source/javascripts/app/lang.js @@ -33,7 +33,9 @@ under the License. global.toc.calculateHeights(); // scroll to the new location of the position - $(window.location.hash).get(0).scrollIntoView(true); + if ($(window.location.hash).get(0)) { + $(window.location.hash).get(0).scrollIntoView(true); + } } // if a button is clicked, add the state to the history