Skip to content

Commit b1e4bad

Browse files
Merge pull request Aerolab#13 from pbock/fix-negative-scroll
Fix negative scroll (e.g. in OS X browsers)
2 parents c1997b9 + db19e7c commit b1e4bad

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
@@ -258,6 +258,9 @@
258258

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

262265
// Get the header's position relative to the document (given that it's fixed)
263266
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)