[OpenLayers-Dev] OpenLayers map.AfterDraw event

Andreas Hocevar ahocevar at opengeo.org
Thu Nov 5 17:02:02 EST 2009


Hi,

maybe you want to use the map's moveend event?

Regards,
Andreas.

geojoe wrote:
> I would like to save the map extent to cookies so I can use it on a page
> refresh.
>
> Is there an AfterDraw event and if not how do I create it so it will fire
> the function below?
>
> function saveMapExtentCookies() {
> 	var bounds = map.getExtent();
> 	var date = new Date();
> 	var days = 1;
>
> 	alert(bounds.Left);
>
>         date.setTime(date.getTime()+(days*24*60*60*1000));
>         var expires = "; expires="+date.toGMTString();
> 	document.cookie = "'mapExtentLeft'="  +bounds.Left    +expires;
> 	document.cookie = "'mapExtentBottom'="+bounds.Bottom +expires;
> 	document.cookie = "'mapExtentRight'=" +bounds.Right  +expires;
> 	document.cookie = "'mapExtentTop'="   +bounds.Top    +expires;
> }
>
>
> Thanks
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Dev mailing list