0

My resizeAreas function doesn't trigger in $(document).ready function. Here's the link to the app. I have also tried $(document).load but same result.

This problem is not consistent. But most of the time the page doesn't load correctly. If the list of task have the same height and 4 equal(as height) lists on the row then they are loaded correctly else they're not. To make sure that you see how it must look you can move a task element from one list to another. I don't have the reputation to post images.

Here is most of the javascript code:

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();
  });
});

Thanks.

Update 1:

I've done some more testing and this bug is only on chrome and firefox but not on IE. The problem appears only on the openshift platform.

3
  • 2
    resizeAreas() is called in the wrong area. remove the () and it may work Commented May 8, 2014 at 21:38
  • I tried it. Same output. Any other ideas? Commented May 8, 2014 at 21:48
  • try renaming the function, maybe it's a reserved name Commented May 9, 2014 at 14:05

2 Answers 2

1

Either change:

$(".dropArea").resize(resizeAreas());

To:

$(".dropArea").resize("resizeAreas");

Or:

$(".dropArea").resize(function(){
  resizeAreas();
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the code review but the proplem persists. I think that the line of code that is causing it, is the line of code above the one that you suggested me to change. When i use debug it works fine.
0

I think it should be

 $(".dropArea").resize(resizeAreas);

Or

 $(".dropArea").resize(function(){
       resizeAreas();
  });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.