[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-05-05 Thread cailinanne
It depends how much control you have over the HTML. If you have control over the HTML, one simple solution is to write the width in another attribute of the image - something that is not re-interpreted by IE 7. E.g. img src="example.jpg" width="100" hwidth="100" and then read the value of

[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-04-15 Thread rudders
Just out of interest how did you work around that? I have been battling this problem for a couple of days now! On Mar 26, 2:30 am, nabrown78 wrote: > Aha! The problem was that the li elements which contained the images > were set to display:none in the CSS. I guess I can work around that. > > On

[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-03-25 Thread nabrown78
But for that you have to wait until all the images have actually loaded. I thought it would be faster to get the attribute. Is that wrong? On Mar 25, 11:39 am, MorningZ wrote: > Use > > this_img.width() > > instead > > http://docs.jquery.com/CSS/width > > On Mar 25, 11:47 am, nabrown78 wrote: >

[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-03-25 Thread MorningZ
yeah, .width() gets or sets the computed width so in your case, grabbing the attribute makes more sense for your situation On Mar 25, 1:38 pm, nabrown78 wrote: > But for that you have to wait until all the images have actually > loaded. I thought it would be faster to get the attribute. Is th

[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-03-25 Thread MorningZ
Use this_img.width() instead http://docs.jquery.com/CSS/width On Mar 25, 11:47 am, nabrown78 wrote: > Hi All, I have the following code: > > $('#slides img').each(function(i){//calculate margins and wrap >                 var this_img = $(this); >                 var imgMargin = Math.round((5

[jQuery] Re: IE7 returning 0 for attr("width") on an img with width set

2009-03-25 Thread nabrown78
Aha! The problem was that the li elements which contained the images were set to display:none in the CSS. I guess I can work around that. On Mar 25, 10:47 am, nabrown78 wrote: > Hi All, I have the following code: > > $('#slides img').each(function(i){//calculate margins and wrap >