Is there a way to detect the actual width of an image in IE7.
Currently we have an Image that changes (we don't know the dimensions in advance at present) and can also be zoomed by the user (changing its $('#img').height()). In IE8 and firefox we can call removeAttr on height to reset the image to its natural size and then calculate based on this. In IE7 removeAttr doesn't work (http://gimp4you.eu.org/sandbox/js/test/removeAttr.html) and setting height to "" entirely hides the image.
So, the height detection works fine the first time, but once the zooming comes into play the height and width are modified, so the next image uses these.
I'd like to avoid entirely removing the img tag and recreate one without the height tag, but is there any other way to acheive this?
Update:
Sorry, wasn't very clear. The issue isn't with storing the loaded height but when the src tag is updated to change the image, the height set in the html/css is remembered - it doesn't use the actual image height. I need to be able to detect the actual image height, ie: if you opened just the image how many pixels tall it is. In better browsers than IE7 using removeAttr('height'), then after the image has loaded, reading the .height() property provides this, however removeAttr doesn't work with IE7 so you are left with a height that has been set by the image.
I've created an example based on Russ C's example here:
If you click 'Image 2' then 'Click Me' then 'Reset', it correctly loads the image, zooms it, and returns to the original size.
However if you click 'Click Me' then 'Image 2' then 'Reset' it stays small (as the height attribute is remembered from the shrunk image. I need to be able to access the proper image size as returned by the first example).
I hope this is clearer.