I ask because I have not found a normal working example anywhere. Suppose there is a block in the middle and at the end of the page. It has data-active = "off" when you have to switch to the data-active block should switch ON together OFF. Or how can it be made easier?
That's not how it works
$('.js-monitor-scroll').each(function(){ var thisY = js-monitor-scroll.offset().top; if (thisY <= (windowHeight * 0.85)) { $('.js-monitor-scroll').attr('data-active', 'on'); } else { $('.js-monitor-scroll').attr('data-active', 'off'); } }); HTML code
<br>` <br> <br> <section class="js-monitor-scroll" data-active="off"></section> <br> <br> <br> <section class="js-monitor-scroll" data-active="off"></section>