2013-08-14 6 views
0

자바 스크립트를 잘 모르지만 내 웹 사이트에 정말 좋을 것 같습니다. 다음은 석조물에 사용하는 JavaScript입니다. 누군가 무한 스크롤링 작동 방법을 보여줄 수 있습니까? 나는 운이없는 그것을 봤다.무한 스크롤링 (벽돌)

<script> 
    (function($){ 

//Finding min and max values in array from http://snippets.dzone.com/posts/show/769 
Array.prototype.min = function(){ return Math.min.apply({},this) }; 
Array.prototype.max = function(){ return Math.max.apply({},this) }; 

$.fn.masonry = function() { 
    this.each(function() { 

     var wall = $(this); 

     if (wall.children().length > 0) { // check if the element has anything in it 

      if(wall.children('.masonryWrap').length == 0) {  // checks if the masonryWrap div is already there 
       wall.wrapInner('<div class=\"masonryWrap\"></div>'); 
      } 
      var mWrap = wall.children('.masonryWrap'); 

      var brick = mWrap.children(); 
      var brickW = brick.outerWidth(true); 
      var colCount = Math.floor(mWrap.width()/brickW) ; 

      var colH=new Array(); 
      for (i=0; i < colCount; i++) { 
       colH[ i ] = 0 ; 
      }  

      mWrap.css({ position: 'relative' }); 

      brick.css({ 
        float: 'none', 
        position: 'absolute', 
        display: 'block' 
       }) 
       .each(function(){ 
        for (i=colCount-1; i > -1; i--) { 
         if (colH[ i ] == colH.min()) { 
          var thisCol = i; 
         } 
        } 
        $(this).css({ 
         top: colH[ thisCol ], 
         left: brickW * thisCol 
        }); 
        colH[ thisCol ] += $(this).outerHeight(true); 
       }); 

      mWrap.height(colH.max()); 
     } 

     return this; 
    }); 
}; 
})(jQuery); 

</script> 
+0

코드로 [jsFiddle] (http://jsfiddle.net/)을 설정할 수 있습니까? –

답변

0

어느 무한 스크롤 및 벽돌 이미 내장, 또는 좀 더 검색을 가지고 이러한 테마 http://zen-themes.tumblr.com/ 중 하나를 사용하십시오. 저를 믿으십시오, 나는이 문제를 이전에 가지고 있고 벽돌과 무한한 두루마리에 관하여 이미 다수의 포스트가있다.

관련 문제