[OpenLayers-Users] css layout for individual layer (openlayers 2)

Jan Hartmann j.l.h.hartmann at gmail.com
Sat Feb 13 09:36:38 PST 2016


Hi folks,

Is it possible to style individual layers of a map with css? I am trying 
to create a map slider effect as described here:

  https://books.google.nl/books?id=nokNCgAAQBAJ&pg=PA251&lpg=PA251&dq=www.theguardian.com+london-riots-before-afterphotographs&source=bl&ots=7KkOoDflUY&sig=PQ22hGTDV8PuZ9E83mv4qmnR9Qk&hl=en&sa=X&ved=0ahUKEwiNmuXdoPXKAhVCIQ8KHWcXA04Q6AEIPzAF#v=onepage&q=www.theguardian.com%20london-riots-before-afterphotographs&f=false

The example webpage from the Guardian does not work at the moment, but I 
have seen it functioning, and it is really a nice effect, very useful 
for maps. And it is really simple to implement for simple images, just a 
few lines of CSS. Javscript is only needed when you want to do it a bit 
fancier.  I just cannot get it working with OpenLayers 2. There is a 
property "div" for a map layer, but setting css styles on it it does 
only work with the "visibility" property. I cannot set borders, or  the 
properties I need for this functionality. Does anyone have any idea? The 
moment I can put a nice css border around a layer, my problem is solved.

Cheers,

Jan
Amsterdam


More information about the Users mailing list