CoffeeScript - detect if current scroll position is below div
I would like to detect when the user scrolls past a certain point in the
window.
[Meta]
X
scroll below = alert()
I'm quite new to CoffeeScript, so any help would be great!
What I currently have is this:
$("#area_1").bind('scroll', ->
scrollPosition = $(this).scrollTop() + $(this).outerHeight()
divTotalHeight = $(this)[0].scrollHeight()
if (scrollPosition >= divTotalHeight)
alert('end reached')
)
And no alert is showing up. Any tips?
No comments:
Post a Comment