關於瀑布流的一些有關問題php+js的

來源:互聯網
上載者:User
關於瀑布流的一些問題php+js的
我從網上下載的瀑布流,弄了半天發現有個問題,



會出現 一列或者 兩列 特別的長
非常不美觀,我看了看代碼,是在js裡面判斷位置並放進去新的內容的,代碼如下:
$(document).ready(function(){
loadMore();
});

$(window).scroll(function(){
// 當滾動到最底部以上100像素時, 載入新內容


if ($(document).height() - $(this).scrollTop() - $(this).height()<100 && $(document).height()<5000) loadMore();

});


function loadMore()
{
$.ajax({
url : 'data.php',
dataType : 'json',
success : function(json){
if(!json){

return;
}else if(typeof json == 'object'){
var oProduct, $row, iHeight, iTempHeight;
for(var i=0, l=json.length; i{
oProduct = json[i];

// 找出當前高度最小的列, 新內容添加到該列
iHeight = -1;
$('#stage li').each(function(){
iTempHeight = Number( $(this).height() );
if(iHeight==-1 || iHeight>iTempHeight)
{
iHeight = iTempHeight;
$row = $(this);
}
});

$(function(){
$(".wf-cld .btn").hide();
$(".wf-cld").hover(function(){
$(".btn",this).show();
},function(){
$(".btn",this).hide();
});
$(".drop").hide();
$(".per").hover(function(){
$(".drop").show();
},function(){
$(".drop").hide();
});
})




$item = $('10000123誘惑誘惑').hide();



$row.append($item);
$item.fadeIn();
}
}
}
});
}


其中這段代碼是檢測在哪裡插入新內容的:
// 找出當前高度最小的列, 新內容添加到該列
iHeight = -1;
$('#stage li').each(function(){
iTempHeight = Number( $(this).height() );
if(iHeight==-1 || iHeight>iTempHeight)
{
iHeight = iTempHeight;
$row = $(this);
}
});

這樣就會出現上述圖片的情況,我想修改成正常的,各位有沒有什麼好的方法呢??
謝謝大家 啊!

分享到:


------解決方案--------------------
應該與你的整體布局有關
你最好貼出可供測試的代碼
------解決方案--------------------
那你是否應該考慮是否 BOM 頭的影響呢?
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.