开发者

HTML, Javascript: How do I load an HTML element when the user scrolls it into view?

Such as, in my case, an element at the bottom of each page with a Disqus comment thread inside. These alone take a few seconds to load o开发者_如何学Gon each page, and it would greatly improve performance if they could be loaded only if the user actually views them.


I was about to suggest handling the scroll event and then checking if the element in question has moved into the viewport, but while researching I found this:

jquery-appear - jQuery plugin to call a function when an element becomes visible

(via another question here on SO: jQuery - Check if element is visible after scroling)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜