When you .hide() the element it brings its height and weight to 0 and
then sets 'display' to 'none'.  You will get unreliable results trying
to read the .height() and .width() after that.

Try this:
var img0 = $("<img src=" + url0 + ">").css({ visibility:
'hidden' }).appendTo(document.body);


Charles
doublerebel.com

On Oct 3, 3:21 am, BAlex <[EMAIL PROTECTED]> wrote:
> 552464979
> Has made so:
>
> $(function() {
>   var url0 = "1.jpg";
>   var img0 = $("<img src=" + url0 +
> ">").appendTo(document.body).hide();
>   var w = img0.width();
>   var h = img0.height();
>   alert("//--> h=" + h + ", w=" + w);
>
> });
>
> It works, here results in different browsers:
> IE:      //--> h=700, w=581 - It is correct
> Opera:   //--> h=700, w=581 - It is correct
> Firefox: //--> h=1002, w=1002 - It is wrong :-((
> Safari:  //--> h=0, w=0 - It is wrong :-((
>
> Whether it is possible to make so that in Firefox and Safari results
> were correct.

Reply via email to