[OpenLayers-Users] Layerswitcher, how to hide overlay checkbox for a layer?

Frank Broniewski brfr at metrico.lu
Wed Dec 18 07:18:11 PST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Or you could use some CSS for the same thing. if you know the ID of
the HTML element, it's pretty easy

#myID {
  display: none !important;
}

or if you want to follow the name path you could

input[name="yourLayerNameHere"] {
  display: none !important;
}

You might want to test the !important switch if it's really necessary.

no need for javascript IMO,

Frank

Am 2013-12-18 13:14, schrieb Jürgen Dankoweit:
> Hello,
> 
> Am 18.12.2013 05:41, schrieb Dmitry Kuzhanov:
>> Hi again, Sorry for the brake.. Basically I wanted to replace
>> traditionally styled checkboxes with nice toggles. As far as I
>> understand checkbox style class is being generated inside
>> openlayers.js file. I've found the code and replaced style name 
>> with my own class. As a result currently it generates nice on/off
>> button. I'm sure you can also reset the class name to smth
>> different or none value and get rid of checkboxes.
> 
> What about using "document.getElementsByName(<layername>)". When
> looking at the DOM element structure of the layerswitch you will 
> see that the name attribute of the checkbox is identical to the
> name of the layer.
> 
> A short code snippet:
> 
> s = NAME_OF_THE_LAYER_AS_SHOWN_IN_LAYERSWITCHER
> 
> var d = document.getElementsByName(s); console.log(d); for (i = 0;
> i < d.length; i++) { if (d[i].type == "checkbox") { 
> console.log(d[i]); d[i].hidden=true; } }
> 
> Put this code in the maximizeControl callback of the layersitcher
> 
> Best regards
> 
> Juergen
> 
>> 
>> 
>> среда, 18 декабря 2013 г. пользователь Dmitry Kuzhanov писал:
>> 
>> Hi, I was recently working on the similar issue, but my idea was
>> to rep
>> 
>> четверг, 12 декабря 2013 г. пользователь Basques, Bob (CI-StPaul)
>> писал:
>> 
>> All,____
>> 
>> __ __
>> 
>> Is there an easy way to still display the layer title in the 
>> switcher, but also hide the checkbox.  I want a layer title in 
>> the switcher that is always on (This is cannot be a baselayer!!, 
>> I need to put things under/over it as far as other layers are 
>> concerned.)____
>> 
>> __ __
>> 
>> Thanks____
>> 
>> __ __
>> 
>> __ __
>> 
>> __ __
>> 
>> Bobb____
>> 
>> __ __
>> 
>> __ __
>> 
>> 
>> 
>> //
>> 
>> 
>> 
>> -- С Уважением, Дмитрий Кужанов./
>> 
>> Московский государственный университет им. М.В. Ломоносова 
>> Географический факультет Кафедра картографии и геоинформатики 8
>> 906 755 06 99
>> 
>> ///
>> 
>> 
>> _______________________________________________ Users mailing
>> list Users at lists.osgeo.org 
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>> 
> 
> 


- -- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSsbynAAoJEHopqW0d1cQVOewH/jjQ1PCX192PoRaY4Cq5+El/
0iFJt1sLhEBul/uuHMEvud/2LOK5HZXP1haBI4r0ikUOo18JOMR269yNfgopiZYp
tbxGLUtUcKWIZZ2TdQIP0MuR8wnPx5mvUKL6o3bx28vch0t91nJz7ILrLljAe76N
WyhAIXLuJA5+fsxSMfCeYJz8DgM00bqEN8GtQO5FOEPKsNzcjeNI3GRiGlkx6S1V
knA59UIiOnsjhDGufl0jEXIJQ3/QrrLcXJlWAcXI5q78LfABTqO7IA6TpCmZmYiB
vlye0xMxQP8U8l47r4pvNO6/kMg6BYrizN7tmVTwKxse2gkU+S8mY5qN4Q2FKi4=
=CTXu
-----END PGP SIGNATURE-----


More information about the Users mailing list