css - Making the leaflet layer control panel responsive with javascript -
i have many lines on leaflet layer control, such spills beyond page. how can below using javascript?
.leaflet-control-layers { overflow: auto; }
what i've tried
-
var controls = l.control.layers(null,overlaymaps,{collapsed: false}); controls.addto(map); controls.style.overflow="auto";
i got controls didn't have
style
attribute the second answer same question
document.getelementbyid("leaflet-control-layers").style.overflow="auto";
nothing happens
not sure got this, guess jquery wasn't being used in map
$(".leaflet-control-layers").style.overflow="auto";
since printed
referenceerror: $ not defined
console.from accepted answer modify css classes using javascript
var layercontrols = document.queryselectorall('.leaflet-control-layers'); for(var i=0; i<layercontrols.length; i++){ layercontrols[i].style.overflow="auto"; }
(nothing happens)
if you're looking set div's overflow auto don't see why can't in css. think reason .style.overflow didn't work because did document.getelementbyid() when 'leaflet-control-layers' class not id.
Comments
Post a Comment