javascript - How to know when a specific div is hidden when page scroll up or down -



javascript - How to know when a specific div is hidden when page scroll up or down -

i have div element in html page located @ position 1200px top,now when user scroll page downwards or , div element showing user javascript function should phone call . , when 1 time again page scrolled up/down div not visible function must called.

use jquery...

snippet:

var $yourdiv = $('.your-div'); $(window).scroll(function(){ if ($(this).scrolltop() > 1200) { $yourdiv.fadein(); } else { $yourdiv.fadeout(); } });

api references:

http://api.jquery.com/scroll/ http://api.jquery.com/scrolltop/ http://api.jquery.com/fadein/ http://api.jquery.com/fadeout/

example:

http://jsfiddle.net/gilla/rqz86z3u/2/

javascript jquery html css

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -