[OpenLayers-Users] autosizing popup containing image does not work in firefox

arno arno at renevier.net
Wed Jul 22 16:47:46 EDT 2009


Hi,
I want to show a popup containing an image. I want it to size automatically 
depending on content (ie: mainly image width and height); so, I use autoSize 
property for popup.

But popup size is not computed correctly in firefox, it's really too small. It 
looks like image dimensions are not part of computed dimensions:
http://renevier.net/misc/ol_autosizeimg.html
(click anywhere on the map to display a popup)

Once image is in cache, dimensions are computed correctly. So, if I reload 
given page, popup will display correctly.

dimensions are computed in OpenLayers.Util.getRenderedDimensions by getting 
popup innerHTML, injecting it in an html element, and checking its 
scrollWidth and scrollHeight properties. Image is not loaded when returning 
from this function, and my guess is its dimensions are unknown to firefox at 
that moment.

Do you think there's a workaround for that ?

thanks
arno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090722/0aa800ad/attachment.bin


More information about the Users mailing list