[Users] geoext.popup - position problem

richard hanssen semska at gmail.com
Wed Jun 2 12:37:07 CEST 2010


Hi

Thanks for the tip.
The url for my image is not clean like in your example. The content
for the html element is prebuildt in a attribute with the complete
html layout.

I could maybe use reg expression to extract the src element of the img-tag.

Thanks for all the help so far!

semska

On Wed, Jun 2, 2010 at 10:35 AM, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Hi,
>
> you can add events to the img. Here is a snippet from my library, used in the context of an OpenLayers popup (where auto-sizing also fails if images tags don't have a width and height attribute or are not preloaded):
>
> var image = new Image();
> image.src = "";
> image.onload = function(){
> // create and display the popup
> popup = new OpenLayers.Popup.FramedCloud("popup",
>    new OpenLayers.LonLat(pos.x, pos.y),
>    new OpenLayers.Size(250,150),
>    "<div class='popupHdg'>" + feature.attributes.text + "</div>" +
>    "<img src='" + feature.attributes.thumb + "'/>" +
>    "<a class='popupLink' target='_blank' href='" + feature.attributes.pdf + "'>PDF</a>",
>    null, true, function(){
>        popupControl.unselect(feature);
>    });
>    feature.popup = popup;
>    map.addPopup(popup);
> };
> image.src = feature.attributes.thumb;
>
> -Andreas.
>
> On Jun 2, 2010, at 10:09 , richard hanssen wrote:
>
>> Hi all,
>>
>> I use the geoext popup to display information from features in the map.
>> My problem is that the positioning of the anchored popup is done
>> before all the content is rendered.
>> The content in the popups html element consists of both text an
>> images. The height of the popup is set before the images is fully
>> loaded, and this leads the popups position/anchor to point below the
>> actual feature when the image loads.
>>
>> My popup def:
>>        popupInstance= new GeoExt.Popup({
>>            title: 'Title',
>>            feature: feature,
>>            width: width,
>>            html: 'content with both text and images',
>>            maximizable: false,
>>            collapsible: false,
>>            unpinnable: false
>>        });
>>
>> Any ideas? Any events that can be called when all content is rendered?
>> I have earlier used OpenLayers' framedCload popup, en the positioning
>> of this was not problematic.
>>
>> Please help.
>>
>> semska
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>


More information about the Users mailing list