jQuery: Set equal div heights doesn't work in firefox, but..?

Discussion in 'jQuery' started by 123GoToAndPlay, Jun 5, 2009.

  1. #1
    Hi all,

    i am having an issue setting equal div heights

    The following works in IE but not in FF. In maincontent i have a nested div.

    Strange thing is when i uncomment the alert, and click the popup the div height is being set in FF??
    and it doesn't matter what i put in the alert box.
    
    $(document).ready(function(){
    
    	test = $("#contentarea").height();
    	//alert(test);
        if($('#contentarea').height() > $('#quote').height())
        {
            $('#quote').css({
                'height':$('#contentarea').height()
            });
        }
        else if($('#quote').height() > $('#maincontent').height())
        {
            $('#maincontent').css({
                'height':$('#quote').height()
            });
        }
    	 
    	
    });
    
    Code (markup):
    any tips?
     
    123GoToAndPlay, Jun 5, 2009 IP
  2. bindassdelhiite

    bindassdelhiite Active Member

    Messages:
    112
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Check this one.

    $(document).ready(function(){
      var test = $("#contentarea").height();
    		
      if (test > $('#quote').height()) {
        $('#quote').css({ height: $('#contentarea').height() });
      }
    	
      else if ($('#quote').height() > $('#maincontent').height()) {
        $('#maincontent').css({ height: $('#quote').height() });
      }
    		
      alert(test); // <- print #contentarea height
    });
    Code (markup):
    Do post the result.

    enjoy :)
     
    bindassdelhiite, Jun 5, 2009 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    123GoToAndPlay, Jun 7, 2009 IP
  4. bindassdelhiite

    bindassdelhiite Active Member

    Messages:
    112
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #4
    At my side in Firefox 3.0.10 this page is working properly, it is, maintaining equal height for both wrappers.

    Other DP members please do check.


     
    bindassdelhiite, Jun 7, 2009 IP
  5. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    @bindassdelhiitte, tx for checking it.

    But now i don't undestand as i am also using FF 3.0.10, but the sidebar isn't as heigh as the maincontent. Only with the alert box. Could this be caused by certain add-ons? (gonna disabled alll of them now)
     
    123GoToAndPlay, Jun 7, 2009 IP