[jQuery] images height() or attr("height") for dynamically added elements

[jQuery] images height() or attr("height") for dynamically added elements


Hello everybody.
I am experiencing difficulties in calculating the height of
dynamically added images.
I have a new plugin wich i have already released and i'm happy wih it,
but one of settings users can choose is to change the 'layout' of the
buttons in the gallery by adding an image instead of the default +/-
text.
To properly vertically-align an image i use to calculate the height of
the contaner /2; then the height of the image to insert /2 and add
margin-top to that image to place vertically aligned in the middle.
An surprisingly it is perfect in ie6 but not in FF.
See yourself:
the grey gallery (under spaceshiptwo) will have two gif for its
buttons. In FF the gifs will be wrongly aligned to the bottom.
I think it's something related to the fact that when i serach for the
gif height, the gif is not loaded so the calculation cannot be made,
but why or how in IE it is calculated?
Also, it is better to use attr("height") that seems to work even if
the height attribute is not set at all or height()?
This is the page, you can look at the sorce of the plugin, line 134
var innerImgH = jQuery("a#right" + j + " span img").attr("height");
http://www.gcmingati.net/wordpress/wp-content/lab/jquery/svwt/index.html