HTML, Javascript: how to load an HTML element when the user scrolls it into view?

For example, in my case, the element at the bottom of each page contains a stream of Disqus comments inside. It takes only a few seconds to load each page, and this will significantly improve performance if they can only be loaded if the user actually views them.

+4
source share
1 answer

I was going to offer to handle the scroll event, and then check if this item moved to the viewport, but when researching, I found this:

jquery-appear - jQuery plugin for calling a function when an element becomes visible

(via another question here on SO: jQuery - check if an element is visible after scrolling )

+1
source

Source: https://habr.com/ru/post/1334248/


All Articles