Skip to content

Commit

Permalink
Add back in pageYOffset catch from #5
Browse files Browse the repository at this point in the history
  • Loading branch information
jh3y committed Oct 30, 2015
1 parent 946560a commit 76cfab1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/coffee/doormat.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ doormat = window.doormat = (el) ->
calibratePanels()
window.onscroll = (e) ->
cur = doormat.current
cur.style.top = -(window.scrollY - cur.DOORMAT_POS) + 'px';
if window.scrollY > (cur.DOORMAT_HEIGHT + cur.DOORMAT_POS)
scroll = window.scrollY or window.pageYOffset
cur.style.top = -(scroll - cur.DOORMAT_POS) + 'px';
if scroll > (cur.DOORMAT_HEIGHT + cur.DOORMAT_POS)
if cur.nextElementSibling
setNew 'next'
else if window.scrollY < cur.DOORMAT_POS
else if scroll < cur.DOORMAT_POS
if cur.previousElementSibling
setNew 'previous'

0 comments on commit 76cfab1

Please sign in to comment.