我的resizeAreas函數不會在$(document).ready
函數中觸發。這是應用程序的link。我也試過$(document).load
但結果相同。jquery函數不會觸發
此問題並不一致。但大部分時間頁面加載不正確。如果任務列表具有相同的高度,並且在行上具有4個相同(作爲高度)列表,則它們被正確加載,否則它們不是。爲了確保你看到了它的外觀,你可以將一個任務元素從一個列表移動到另一個列表。我沒有發佈圖片的聲望。
這裏是最的JavaScript代碼:
function makeDropArea() {
var widthArea = $(".taskListing").width()/2 - 55;
var heightArea = $(".taskListing").height();
$('.dropArea').width(widthArea);
$('.dropArea').css('margin-left', 5 + 'px');
$('.generalInfo').css('margin-left', 5 + 'px');
$('.generalInfo').css('width', widthArea * 2 + 220 - 45);
$('.subTaskHeader').css('width', widthArea + 25);
}
function makeDropElement(){
var widthEl = $('.dropArea').width() + 25 ;
$('.task').width(widthEl);
}
function taskListingSize(){
var width = getWidth();
var height = getHeight() * 80/100;
$('.taskListing').css('width', width);
}
function resizeAreas() {
$('.taskListing').each(function(){
var highestBox = 0;
$('.dropArea', this).each(function(){
if($(this).height() > highestBox)
highestBox = $(this).height();
});
$('.dropArea',this).css('min-height', highestBox);
});
}
$(document).ready(function() {
menu();
taskListingSize();
makeDropArea();
makeDropElement();
resizeAreas(); //<-- this is the one with the problems
$(".dropArea").resize(resizeAreas());
$(window).resize(function() {
taskListingSize();
makeDropArea();
makeDropElement();
});
});
感謝。
更新1:
我已經做了一些測試,這個bug只在Chrome和Firefox,但不是在IE瀏覽器。該問題僅出現在openshift平臺上。
resizeAreas()在錯誤的區域中調用。刪除'()',它可能工作 – Ibu
我試過了。相同的輸出。任何其他想法? – user3618198
嘗試重命名該函數,也許它是一個保留名稱 – TecHunter