[OpenLayers-Users] Popup in Openlayers (How to fix the popup?)

Alexandre Dube adube at mapgears.com
Thu Jul 16 08:18:27 EDT 2009


Hi,

  You could register a map 'moveend' event to move the popup again to 
the original location.  You would need to recalculate the position on 
each move.

Regards,

Alexandre

Kwong Hu Kiu wrote:
> Hi,
>
> I am trying to use the openlayers popup in the map as below.
>
>      if (this.popup == null)
>             {
>                 this.popup = new OpenLayers.Popup();
>                 this.popup.setBorder("2px solid");
>                 this.popup.setSize(new OpenLayers.Size(270, 270));
>                 this.popup.setContentHTML(popupContentHTML);
>                 this.popup.setOpacity(0.65);
>                 this.popup.addCloseBox();
>                 map.addPopup(this.popup);
>                 this.popup.show();
>             }
>             else
>             {
>                 this.popup.setContentHTML(popupContentHTML);
>                 this.popup.toggle();
>             }
>
>
> How do i get it to display in one position (like the lower left 
> portion of the screen) ? and always appear there whenever you pan/zoom
>
> I figured that i can use popup.moveTo as below.
>
> var widthPixel = map.getSize().w - 280;
> var heightPixel = map.getSize().h - 300;
> this.popup.moveTo(new OpenLayers.Pixel(widthPixel, heightPixel));
>
> But the popup will move out of that location whenever you pan. It's 
> alright when you zoom in/out(always at the lower left) but not pan.
>
> Please help. Simple problem taking me a while to resolve.
>
> Cheers.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list