Javascript 如何通过单击按钮,甚至单击传单中的标记来打开菜单的按钮
我从github中删除了这个侧边栏和它的源代码,正如你所看到的,当点击标记时,它不做任何动作,我尝试了很多方法,在点击标记时打开它并带来内容,如果可能,请通过单击标记向我显示一个命令以使其打开,谢谢。您可以尝试以下方法来关闭/折叠侧边栏:Javascript 如何通过单击按钮,甚至单击传单中的标记来打开菜单的按钮,javascript,jquery,html,css,leaflet,Javascript,Jquery,Html,Css,Leaflet,我从github中删除了这个侧边栏和它的源代码,正如你所看到的,当点击标记时,它不做任何动作,我尝试了很多方法,在点击标记时打开它并带来内容,如果可能,请通过单击标记向我显示一个命令以使其打开,谢谢。您可以尝试以下方法来关闭/折叠侧边栏: function showhidebar(){ button = document.getElementsByClassName('fa fa-bars')[0] button.click() } map.eachLayer(function(l){if
function showhidebar(){
button = document.getElementsByClassName('fa fa-bars')[0]
button.click()
}
map.eachLayer(function(l){if (l instanceof L.Marker) {l.on('click', showhidebar)}});
非常感谢你,你帮了我很多,我在任何地方都找不到解决办法