'Leaflet. Icon marker follow to mouse

i want create following icon marker to mouse when i choose place (gif)

How do i write this

JS

let objectType = document.getElementById('cursor');
document.onmousemove = function(event){
    objectType.style.left = event.clientX+'px';
    objectType.style.top = event.clientY+'px';
}

HTML + CSS

<img src="/public/images/icon/obj.png" id="cursor" class="cursor"/>

.cursor {
    position: fixed;
    visibility: hidden;
}

But this does not allow you to click on the map and it is superimposed on the interface

How to do it better?

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source