There is a so-called "news" tape. There are not news but tiles. Tiles with text that are loaded from the database. so here In VK, when scrolling through the news, the news is automatically loaded by itself. I decided to do something similar. I use JS and the scroolTop () function. I do this:
$(document).ready(function() { var height = screen.height, append_height = height/2, elements = 49, //сколько плиточек append = false; console.log("height " + height); console.log("append_height " + append_height); $(window).scroll(function() { $('a.text').text($(this).scrollTop()); if($(this).scrollTop() > append_height) { $('a.text-1').text("scrollTop() > append_height: " + $(this).scrollTop() + " " + append_height); for(var i = 0;i <= elements; i++) { $('.feed-main ul').append('<li class="link-block">' + i + '</li>'); } append_height+=height; $('a.text-2').text("append_height+=height = " + append_height); console.log("append_height " + append_height); } }); }); For debugging, I display information in the console and in tags a .
So. When it comes to these values (debag):
7669 SCROLLTOP ()> APPEND_HEIGHT: 6738 6656 APPEND_HEIGHT + = HEIGHT = 7680
Next, the tiles are not loaded (for the test just made an addition to the end of ul). Why - I can not understand. What could it be?