Skip to content

Commit

Permalink
IE8 innerHeight workaround
Browse files Browse the repository at this point in the history
attilaolah committed Sep 3, 2014
1 parent 131b389 commit 82f1996
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 9 additions & 1 deletion dist/wow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/wow.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/wow.coffee
Original file line number Diff line number Diff line change
@@ -31,6 +31,11 @@ class Util
else # fallback
delete elem[event]

innerHeight: ->
if 'innerHeight' of window
window.innerHeight
else document.documentElement.clientHeight

# Minimalistic WeakMap shim, just in case.
WeakMap = @WeakMap or @MozWeakMap or \
class WeakMap
@@ -230,7 +235,7 @@ class @WOW
isVisible: (box) ->
offset = box.getAttribute('data-wow-offset') or @config.offset
viewTop = window.pageYOffset
viewBottom = viewTop + Math.min(@element.clientHeight, innerHeight) - offset
viewBottom = viewTop + Math.min(@element.clientHeight, @util().innerHeight()) - offset
top = @offsetTop(box)
bottom = top + box.clientHeight

0 comments on commit 82f1996

Please sign in to comment.