Skip to content

Commit db19e7c

Browse files
committed
Fix negative scroll (e.g. in OS X browsers)
1 parent 61e890a commit db19e7c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

midnight.jquery.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@
260260

261261
// Check classes are currently active in the header (including the current percentage of each)
262262
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
263+
// Some browsers (e.g on OS X) allow scrolling past the top/bottom.
264+
scrollTop = Math.max(scrollTop, 0);
265+
scrollTop = Math.min(scrollTop, $(document).height());
263266

264267
// Get the header's position relative to the document (given that it's fixed)
265268
var headerHeight = headerInfo.height;

midnight.jquery.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)