mercredi 28 janvier 2015

to check if a particular div is seen on the screen


Vote count:

0




I tried to use the following function to check if a particular div is on the screen



function checkViewport(element) {
return $(element).offset().top >= $(window).scrollTop() && $(element).offset().top<= $(window).scrollTop() + $(window).height();
}


However, the page that I'm using this function on is not responsive. When I make the window size completely small & then scroll down, even if I don't see the div on the screen, I can see the checkViewport returning true, Not sure what's wrong with the function above





asked 1 min ago







to check if a particular div is seen on the screen

Aucun commentaire:

Enregistrer un commentaire