Skip to content

Commit 2129ffd

Browse files
collnwalkrspinningarrow
authored andcommitted
fix document.body.scrollTop issue in Firefox.
1 parent 2fbaccc commit 2129ffd

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

dist/zoom-vanilla.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.

dist/zoom-vanilla.min.js.map

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

js/zoom-vanilla.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
// From http://youmightnotneedjquery.com/#offset
55
function offset(element) {
66
var rect = element.getBoundingClientRect()
7-
87
return {
9-
top: rect.top + document.body.scrollTop,
8+
top: rect.top + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
109
left: rect.left + document.body.scrollLeft
1110
}
1211
}

0 commit comments

Comments
 (0)