I'm bringing in the elements with AJAX. If you scroll down the page, you can see a certain part. Is there a way to figure out what we see here?
javascript jquery
function isScrolledIntoView(elem)
{
var $elem = $(elem);
var $window = $(window);
var docViewTop = $window.scrollTop();
var docViewBottom = docViewTop + $window.height();
var elemTop = $elem.offset().top;
var elemBottom = elemTop + $elem.height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
There's a way like this way.
© 2024 OneMinuteCode. All rights reserved.