Skip to content

Commit c67cc4e

Browse files
author
Konstantin
committed
fixed thrown TypeErrors on mac, while scrolling over the top edge
Due to the mac specific possibility to scroll above the top viewport edges (this nice viewport pull effect), you get some negative scroll and offset values. This causes a call of this.names[-1] which throws a TypeError. So we just test for a positive scroll value to prevent this.
1 parent 04e401f commit c67cc4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/javascript/garden.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Sections.prototype = {
3333
articleID = this.names[this.names.length - 1].id;
3434

3535
for(var i = 0, l = this.names.length; i < l; i++) {
36-
if (this.names[i].offset > scroll) {
36+
if (scroll > 0 && this.names[i].offset > scroll) {
3737
articleID = this.names[i - 1].id;
3838
break;
3939
}

0 commit comments

Comments
 (0)