Skip to content

Commit c16f1d6

Browse files
committed
Fix incorrect position in Firefox
* firefox-fix: applied fix to offset( ) return left. fix document.body.scrollTop issue in Firefox.
2 parents 2fbaccc + 3f4a62c commit c16f1d6

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
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,
10-
left: rect.left + document.body.scrollLeft
8+
top: rect.top + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
9+
left: rect.left + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0
1110
}
1211
}
1312

0 commit comments

Comments
 (0)