[OpenLayers-Users] put a message inside map for some zoom levels

Luis Ortiz --CompeGPS Team-- lortiz at compegps.com
Thu Jun 4 12:48:28 EDT 2009


finally i got it!

Thank you for your help.


Christoph Boehme escribió:
> Luis Ortiz --CompeGPS Team-- wrote:
>> We would like to put a message inside the map when is not possible to 
>> show tiles and user has to zoom in to watch them.
>>
>> Is a message at top right with a red background only to show when 
>> zoom is more far than 8th level.
> >
>> I saw this in googlemaps but i don't know how to do it in openlayers.
>
> Try the following:
>
> Add a div-element containing your message to your html code and use 
> some css to position it whereever you want (you probably want to use 
> position: absolute or fixed for this). Set the display css property of 
> the div to none.
>
> In your javascript code register an event handler for the zoomend 
> event on your map object. Within the event handler you can use the 
> getZoom() method of the map to determine the current zoom level and 
> decide than change the value of the display property of your div.
>
> For details I recommend you read the documentation on
> http://docs.openlayers.org/ and 
> http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers-js.html 
>
>
>     Cheers,
>     Christoph



More information about the Users mailing list