jquery - Discrepancy between outputs from firefox and chrome for 'console.log' -


Why does Firefox give me the correct output but does not chrome?

I am trying to find the height of a div which is not specified in the stylesheet or elsewhere.

Chrome gives me an integer value of '20', but firefox gives me the correct value (using firebug) 516.

This is a console.log code that generates:

  var img_h = $ ("# pics"). Height (); Console.log (img_h); & Lt; Div id = "pics" width = "100%" & gt; & Lt; Img src = "image1.jpg" width = "45%" & gt; & Lt; Img src = "image2.jpg" width = "45%" & gt; & Lt; / Div & gt;  

Thoughts?

If you want to load images, instead of document.ready Should be used, such as:

  $ (window). Load (function () {var img_h = $ ("# pics") .height (); console.log (img_h);});  

The most notable difference is that the images (Dynamically not created!) Are loaded and ready when this code runs.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -