How can you be lazy to load content without image in jQuery?

I want lazy to upload the results of my Youtube API search, so that when a user scrolls down, Youtube players are added to the page. It seems that the lazy download plugins are image oriented, but what I will download is just HTML, because I use iFrames to load Youtube players (in line with the new Youtube embed style). How to do it in jQuery? Thanks for reading.

+3
source share
3 answers

If you understand correctly, you need something like:

$( "body").scroll( function() {
   $( "#youtubeDiv").load( "youtube.html");
});

Instead of loading you can add a html fragment.

0

.scroll() .ScrollTop(), , /. , iframe . , ( ) . .

0

What you want to do is probably easily accomplished with the jQuery infinite scroll plugin

Source available on github

0
source

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


All Articles