JQuery: How can I check if a block in my document is inside the viewport or outside of it?
Basically I'm trying to call a function if the footer is inside the viewport.
How can I check if the footer is showing in the viewport?
I'm guessing I'll have to put it on an event $(window).scroll()
for the listener to become true when the footer becomes visible, but what the function should be, which I just can't figure out.
Any help would be much appreciated.
Thanks for reading,
Jannis
+2
a source to share
2 answers
I found this answer more helpful when looking for something like this: jQuery Show / Hide Div when the section is in the viewport
Or jump straight to Alison's example: http://jsfiddle.net/EADDt/
0
a source to share