Leaflet: using mouseover and opacity get a conflict

11 views
Skip to first unread message

Elton Santos

unread,
Nov 30, 2017, 7:12:48 AM11/30/17
to Leaflet

I created a function to mouse over a colorless layer and everything. So far so good, and also created a function to go back as it was before the mouse. But when I use the opacity, the reset function does not return to normal and leaves the opacity in the default state (0.7) and not in the state it is in at the moment.


Function to mouseouver:


function highlightFeature_stComerciais(e) {
            layerStComerciais
= e.target;
            layerStComerciais
.setStyle({
                weight
: 5,
                color
: '#666',
                dashArray
: ''
           
});
            info
.update(layerStComerciais.feature.properties);
       
}



function to mouseout


function resetHighlight_stComerciais(e) {
            setoresComerciaisOverlay
.resetStyle(e.target);
            info
.update();
       
}


opacity:


$('#sldOpacity').on('change', function(){
            $
('#image-opacity').html(this.value);
            setoresComerciaisOverlay
.setStyle({ fillOpacity: this.value })  
       
});


The default opacity is 0.7, assuming I put 0 of opacity, when I do mouse over the Layer all right, but when I mouse out it returns to 0.7 and I do not want this. Why my reset doesnt work how I want? Thanks!

Elton Santos

unread,
Nov 30, 2017, 7:15:30 AM11/30/17
to Leaflet
Reply all
Reply to author
Forward
0 new messages