[jQuery] Re: Getting width of broken image updated: working now

2008-10-30 Thread Andy Matthews
To: jquery-en@googlegroups.com Subject: [jQuery] Re: Getting width of broken image? Another thing you can try is attach the handler directly to the load event for each image: $(img).load(function() { alert('image ' + this.src + ' is loaded and has width ' + $(this).width()); }); This should work ok

[jQuery] Re: Getting width of broken image updated: working now

2008-10-30 Thread Josh Nathanson
: Wednesday, October 29, 2008 2:44 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Getting width of broken image? Another thing you can try is attach the handler directly to the load event for each image: $(img).load(function() { alert('image ' + this.src + ' is loaded and has width

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Andy Matthews
website. andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of weidc Sent: Wednesday, October 29, 2008 9:15 AM To: jQuery (English) Subject: [jQuery] Re: Getting width of broken image? hi, eh.. did you copy your code? 'Cause you wrote {'img

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread weidc
hi, eh.. did you copy your code? 'Cause you wrote {'img'). On 29 Okt., 14:30, Andy Matthews [EMAIL PROTECTED] wrote: I'm loading in a batch of images dynamically. Some of the images might not exist and I'm wondering how I might test for that image using jQuery (1.2.6). All I really want to

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread weidc
website. andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of weidc Sent: Wednesday, October 29, 2008 9:15 AM To: jQuery (English) Subject: [jQuery] Re: Getting width of broken image? hi, eh.. did you copy your code? 'Cause you wrote {'img

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread ricardobeat
Besides the bracket weidc mentioned, is your document valid? I get the correct image width by using width() on both IE and FF. Alternatively you can check for the offsetWidth attribute. $('img').each(function(){ alert(this.offsetWidth500); }); On Oct 29, 11:30 am, Andy Matthews [EMAIL

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Andy Matthews
Okay... I figured out why it's not working. My code is firing before the images are fully loaded, therefore the width of the image is zero until the browser downloads the image. I installed a click event on each image which reported the actual width correctly. So, how might I only run this

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Josh Nathanson
) jquery-en@googlegroups.com Sent: Wednesday, October 29, 2008 9:24 AM Subject: [jQuery] Re: Getting width of broken image? Okay... I figured out why it's not working. My code is firing before the images are fully loaded, therefore the width of the image is zero until the browser downloads the image

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Andy Matthews
: [jQuery] Re: Getting width of broken image? Okay... I figured out why it's not working. My code is firing before the images are fully loaded, therefore the width of the image is zero until the browser downloads the image. I installed a click event on each image which reported the actual width

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Josh Nathanson
and have the event handler bound before the images themselves are loaded. -- Josh - Original Message - From: Andy Matthews [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, October 29, 2008 11:37 AM Subject: [jQuery] Re: Getting width of broken image? Hrm

[jQuery] Re: Getting width of broken image?

2008-10-29 Thread Andy Matthews
That might get me where I want to go. Thanks Josh! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh Nathanson Sent: Wednesday, October 29, 2008 2:44 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Getting width of broken image