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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -