我遇到了一個高度相同的腳本問題,這使得我的4個div的行高度相等。在一個div中,我有neosmart-stream,它在div中加載了我最新的facebook文章。其他div應該與高度匹配,問題在於div高度與首先加載的最高div相匹配,其中包含目錄圖片。加載一個函數,接着加載
我希望能夠在我的Facebook發佈後加載運行等高度腳本。 以下是該網站的鏈接:http://www.guitarworldcityarcade.com.au/ 它適用於旋轉橫幅下面的4個深灰色框。
對不起,我沒有提供代碼的大錯誤。下面是相等的高度代碼:
<script>
equalheight = function(container){
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function() {
$el = $(this);
$($el).height('auto')
topPostion = $el.position().top;
if (currentRowStart != topPostion) {
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
rowDivs.length = 0; // empty the array
currentRowStart = topPostion;
currentTallest = $el.height();
rowDivs.push($el);
} else {
rowDivs.push($el);
currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
}
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
});
}
$(window).load(function() {
equalheight('.module');
});
$(window).resize(function(){
equalheight('.module');
});
</script>
這裏是爲Facebook的職位代碼:
<div class="module">
<h1>News</h1>
<script type='text/javascript' src='http://www.guitarworldcityarcade.com.au/neosmart-stream/nss-includes/jquery.js'></script>
<script type='text/javascript' src='http://www.guitarworldcityarcade.com.au/neosmart-stream/nss-core/jquery.neosmart.stream.js'></script>
<link href='http://www.guitarworldcityarcade.com.au/neosmart-stream/nss-core/core.css' type='text/css' rel='stylesheet' />
<link href='http://www.guitarworldcityarcade.com.au/neosmart-stream/nss-content/themes/base/style.css' type='text/css' rel='stylesheet' />
<script type='text/javascript'>(function(window){window.onload=function(){jQuery(function(){jQuery('#nss').neosmartStream({introFadeIn:695,masonry:false,cache_time:60,theme:'base',path:'http://www.guitarworldcityarcade.com.au/neosmart-stream/',channel_group:'all',auto_refresh:true,auto_refresh_time:60})})}})(window);</script>
這僅僅是一些腳本,facebook的帖子是一個插件。這四個div具有.module類
一個有window.load(function())和另一個window.onload = function(),它們會發生衝突嗎?有沒有辦法讓我可以在另一個之後加載這麼多毫秒?
你有密碼嗎?我們可以在這裏看到,而不是在您的網站上查找 –
您可能需要找到正確的'load'事件來偵聽並運行您的腳本,但是我建議您發佈如何加載facebook文章以便我們可以看看可能的選擇。 – jfriend00
如果該neosmart-stream支持事件,則可以偵聽一個加載事件並運行等高度腳本。 – Todd