In order to improve the performance of my very long HTML page containing over 2000 products, I decided to hide 50% of the divs by changing the CSS display property to none. This significantly increased the page's performance on older computers with memory constraints.
My goal is to have the display set to block only when the div is in view on the screen.
I attempted to use a script from , but even after updating the method from on to bind, it still did not work as intended.
Is there an elegant solution to create a CSS class that only appears when the element is on screen?