Skip to content

Commit 31eea37

Browse files
committed
Fix a small issue with the menu highlighting on page load
1 parent 5fbb104 commit 31eea37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

html/js/garden.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ $(document).ready(function() {
4040
}
4141

4242
function highlightSection() {
43+
console.log('foo');
4344
var offset = $(window).scrollTop();
4445
var id = articles[0][1];
4546
for(var i = 0, l = articles.length; i < l; i++) {
@@ -49,11 +50,12 @@ $(document).ready(function() {
4950
}
5051
selectNavigation(id, offset === 0);
5152
}
53+
54+
var initSelection = setTimeout(highlightSection, 50);
5255
$(document).scroll(function() {
56+
clearTimeout(initSelection);
5357
highlightSection();
5458
});
55-
setTimeout(highlightSection, 0);
56-
5759
prettyPrint();
5860
});
5961

0 commit comments

Comments
 (0)