[jQuery] Re: Question to experts on jQuery.

2007-10-05 Thread Flesler
Uff I'm sorry, check the " ' " part... it should say: " '' "... I'm sorry.. This is fixed, and I tested it in Firefox 2.0.0.7 and IE6, both Windows. Make sure you put a valid image url instead of xyz.jpg. $(function(){//make sure this happens after document ready. $('').load(function(){

[jQuery] Re: Question to experts on jQuery.

2007-10-04 Thread BAlex
I regret, but anything from offered does not work as it is necessary in Firefox and Safari.

[jQuery] Re: Question to experts on jQuery.

2007-10-04 Thread Flesler
Your initial code should work, I realized that it wasn't working at the beggining because it wasn't in the DOM. So this, should work: $(') .load(function(){ var width = $(this).width(), height= $(this).height(); alert(width + ' '+ height); }) .attr('src'

[jQuery] Re: Question to experts on jQuery.

2007-10-03 Thread Wizzud
Just do it the old-fashioned way... var objImage = new Image(); objImage.onload = function(){ var imgDim = { width : objImage.width, height : objImage.height }; // .. carry on processing... }; objImage.src = 'myPicture.jpg'; BAlex wrote: > > > Is JavaSc

[jQuery] Re: Question to experts on jQuery.

2007-10-03 Thread polyrhythmic
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 = $("").css({ visibility: 'hidden' }).appendTo(document.body); Charles doublerebel.com

[jQuery] Re: Question to experts on jQuery.

2007-10-03 Thread BAlex
552464979 Has made so: $(function() { var url0 = "1.jpg"; var img0 = $("").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 Oper

[jQuery] Re: Question to experts on jQuery.

2007-10-02 Thread sgrover
Your code as is won't work, unless the image is cached - and even then it'll be hit an miss. The img.src = "1.jpg" line is an asynchronous call. WHILE the image is loading the next line is executed. Seeing as the image probably didn't load in a microsecond or less, the width/height values w

[jQuery] Re: Question to experts on jQuery.

2007-10-02 Thread polyrhythmic
You have to specify the image source, otherwise you are loading nothing. The code should read: var $img0 = $("").load( .. Charles On Oct 2, 9:55 am, BAlex <[EMAIL PROTECTED]> wrote: > Has made: > > var width, height; > var img0 = $("").load(function(){ >

[jQuery] Re: Question to experts on jQuery.

2007-10-02 Thread BAlex
Has made: var width, height; var img0 = $("").load(function(){ width = $(this).width(); height= $(this).height(); }).attr("src", "1.jpg"); alert("//--> img0=" + img0 + ", w=" + width + ", h=" + height); Has

[jQuery] Re: Question to experts on jQuery.

2007-10-02 Thread BAlex
552464979 Has made: var width, height; var img0 = $("").load(function(){ width = $(this).width(); height= $(this).height(); }).attr("src", "1.jpg"); alert("//--> img0=" + img0 + ", w=" + width + ", h=" + hei

[jQuery] Re: Question to experts on jQuery.

2007-10-02 Thread Flesler
You want to save the real height/width to a variable, or to set it programatically? if you want to retrieve the real attributes you will need to check, only after the image has loaded (on the event onload): something like this. var width, height; var $img = $(') .load(functi