单张图层控件仅在单击时打开 [英] Leaflet layer control open only on click
本文介绍了单张图层控件仅在单击时打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只有单击才能打开小叶图层控件吗?
Is there any way to open leaflet layer control only when clicked?
默认情况下,鼠标悬停/鼠标悬停时它会展开/折叠.我只想点击打开.
By default, it expands/collapse when on mouseover/mouseout. I want to open only on click.
推荐答案
在鼠标悬停时停止传播已解决.我在这里使用d3,但可以通过普通javascript或jQuery轻松处理.
Stop propagation on mouse over solved it. I am using d3 here but It can be easily handled by plain javascript or by jQuery.
d3.select(".leaflet-control-layers-toggle").on("mouseover", function () {
//this will make sure that layer popup menu
//not opens when mouseover
d3.event.stopPropagation();
});
这篇关于单张图层控件仅在单击时打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文