Динамическая загрузка блоков при скроллинге

<div id="lazyblock">
<script>
function lazyblock(){
   var wt = $(window).scrollTop();    //* top of the window
   var wb = wt + $(window).height();  //* bottom of the window
 
   $("#lazyblock").each(function(){
      var ot = $(this).offset().top;  //* top of object (div)
      var ob = ot + $(this).height(); //* bottom of object
      if(!$(this).attr("loaded") && wt<=ob && wb >= ot){
         $(this).html('<iframe src="/block.html" scrolling="no" frameborder="0"
                        style="border:none; overflow:hidden; width:211px; height:790px;" allowTransparency="true">
                      </iframe>');
         $(this).attr("loaded",true);
      }
   });
}
 
$(document).ready(function(){
    $(window).scroll(lazyblock);
    lazyblock();
});
</script>
</div>


Оставить комментарий

Содержание этого поля является приватным и не предназначено к показу. Если есть аккаунт Gravatar, то отображается глобальный аватар.

Подробнее о форматировании

КАПЧА
А ты не робот? Введи 5 цифр
                                                                      
ad888888b, ad88888ba 8888888888 ad8888ba, ad88888ba
d8" "88 d8" "8b 88 8P' "Y8 d8" "88
a8P Y8a a8P 88 ____ d8 8P 88
,d8P" "Y8aaa8P" 88a8PPPP8b, 88,dd888bb, Y8, ,d88
a8P" ,d8"""8b, PP" `8b 88P' `8b "PPPPPP"88
a8P' d8" "8b d8 88 d8 8P
d8" Y8a a8P Y8a a8P 88a a8P 8b, a8P
88888888888 "Y88888P" "Y88888P" "Y88888P" `"Y8888P'

Enter the code depicted in ASCII art style.
To prevent automated spam submissions leave this field empty.