Javascript jquery函数没有';t触发器
My resizeAreas函数不会在Javascript jquery函数没有';t触发器,javascript,jquery,Javascript,Jquery,My resizeAreas函数不会在$(document).ready函数中触发。下面是应用程序的链接。我还尝试了$(document).load,但结果相同 这个问题并不一致。但大多数情况下,页面无法正确加载。如果任务列表在该行上具有相同的高度和4个相等(作为高度)的列表,则它们被正确加载,否则它们不会被正确加载。为了确保看到它的外观,可以将任务元素从一个列表移动到另一个列表。我没有发布图片的名声 以下是大部分javascript代码: function makeDropArea() {
$(document).ready
函数中触发。下面是应用程序的链接。我还尝试了$(document).load
,但结果相同
这个问题并不一致。但大多数情况下,页面无法正确加载。如果任务列表在该行上具有相同的高度和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();
});
});
函数makeDropArea(){
var widthArea=$(“.taskListing”).width()/2-55;
var heightArea=$(“.taskListing”).height();
$('.dropArea')。宽度(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);
}
函数makeDropElement(){
var widthEl=$('.dropArea').width()+25;
$('.task').widthEl;
}
函数taskListingSize(){
var width=getWidth();
var height=getHeight()*80/100;
$('.taskListing').css('width',width);
}
函数大小调整区域(){
$('.taskListing')。每个(函数(){
var-highestBox=0;
$('.dropArea',this).each(函数(){
if($(this).height()>highestBox)
highestBox=$(this).height();
});
$('.dropArea',this).css('min-height',highestBox);
});
}
$(文档).ready(函数(){
菜单();
taskListingSize();
makeDropArea();
makeDropElement();
调整区域大小();//更改:
$(".dropArea").resize(resizeAreas());
致:
或:
我想应该是这样
$(".dropArea").resize(resizeAreas);
或
在错误的区域调用resizeAreas()。请删除()
它可能会工作。输出相同。还有其他想法吗?尝试重命名该函数,可能它是一个保留名称感谢代码审阅,但问题仍然存在。我认为导致它的代码行是您建议我更改的代码行之上的代码行。当我使用debug时,它工作正常。
$(".dropArea").resize(function(){
resizeAreas();
});
$(".dropArea").resize(resizeAreas);
$(".dropArea").resize(function(){
resizeAreas();
});