JQuery calculating heights differs in Firefox and Chrome

I have a question that has already been asked here , but the solution proposed there did not work. The problem is that I am using the jQuery height () function to return the div height. It works fine in Firefox, but returns a value that is 300 pixels smaller in Chrome ...

Here you can see an example of this error here . Although I have to say it in Hebrew. Although it does not really matter ...

Has anyone had this before? Here is the code that calculates the height:

var heightLeftCol = $('#leftCol').height();
var sidebarHeight = $('#sidebar').height();
var minHeight = heightLeftCol > sidebarHeight ? heightLeftCol : sidebarHeight; 
$('#postArea').css('min-height', minHeight+100);

EDIT: This problem was not fixed , but worked around in a way that I did not like, but now it will be done. Here is the “solution” I came up with:

if (jQuery.browser.safari) {
    $('#postArea').css('min-height', minHeight+400 + 'px');
}
else {
    $('#postArea').css('min-height', minHeight+100 + 'px');
}

Safari Chrome WebKit, browser.safari . .

! Amit

+5
3

Chrome div 300 "sheli.jpg", html css. height="300" <img> height: 300px; , .

+16

, , 0. , Chrome. , , jQuery(window).load() :

jQuery(window).load(function(){
     jQuery("#div1").css("height", jQuery("#div2").height());
});
+8

In the discussion that Justin and I discussed in previous comments, wrapping jQuery code in $ (window) .load () will allow this code to work correctly after the images are fully loaded.

+5
source

All Articles