Reputation: 13
I have Millions div
row. I want to add active
class 7 div
in scrollbar viewport and remaining all div
hide. when I scroll active state change according to scrollbar viewport. Items can be Millions in row. I need this for Improve loading time.
https://jsfiddle.net/sapans/afghq58e/3/
Upvotes: 1
Views: 292
Reputation: 5869
<div>
<div class="a">
A
</div>
.a {
height: 300px;
width: 300px;
background-color: green;
}
$(window).scroll(function() {
if ($(this).scrollTop()>0)
{
$('.a').fadeOut();
}
else
{
$('.a').fadeIn();
}
});
Working example click here for jsfiddle
Upvotes: 1