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

  1. this answer

    var controls = l.control.layers(null,overlaymaps,{collapsed: false});   controls.addto(map);   controls.style.overflow="auto"; 

    i got controls didn't have style attribute

  2. the second answer same question

    document.getelementbyid("leaflet-control-layers").style.overflow="auto"; 

    nothing happens

  3. not sure got this, guess jquery wasn't being used in map

    $(".leaflet-control-layers").style.overflow="auto"; 

    since printed referenceerror: $ not defined console.

  4. 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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -