DEV Community

sarahch29
sarahch29

Posted on

1

Mouse over leaflet problem

hello guys!
i'm facing a problem of mouseover event in leaflet

here is my code :

function highlightFeature(e) {
        var layer = e.target;
        const { name, CWILAYA } = e.target.feature.properties;
        setSelected({
            name: name,
            CWILAYA: CWILAYA

        });
        layer.setStyle({
            weight: 6,// change the weight  of  a state 
            fillOpacity: 1
        });
        if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
            layer.bringToFront();
        }
    }
function onEachFeature(feature, layer) {
            layer.on({
                mouseover: highlightFeature,// call the function when mouseover  
            });
Enter fullscreen mode Exit fullscreen mode

Image description

when i hover ,the weight of the city changes for 2s and it doesn't stay highlighted even though the mouse is over the city

can you please help me !
thank you

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay