http://jsfiddle.net/Rxs2m/135/
The IDs are incorrect, so .offset()
returns nothing (and .offset().top
causes an error).
Change to $("#en")
and $("#to")
.
Finally, wrap everything in a callback to $(window).scroll()
and it is checked each time the window scrolls.