javascript - 如何通过单击按钮甚至传单中的标记来制作使我的菜单打开的按钮
问题描述
我正好有这个侧边栏https://turbo87.github.io/sidebar-v2/examples/index.html以及我从该 github https://github.com/Turbo87/sidebar-v2/blob中删除的源代码/master/examples/index.html,正如您在单击标记时看到的那样,它没有执行任何操作,我尝试了多种方式使其在单击标记时打开并带来内容,如果可能的话,请向我显示一个命令通过单击标记使其打开谢谢。
解决方案
您可以尝试这样的方法来关闭/折叠侧边栏:
function showhidebar(){
button = document.getElementsByClassName('fa fa-bars')[0]
button.click()
}
map.eachLayer(function(l){if (l instanceof L.Marker) {l.on('click', showhidebar)}});
推荐阅读
- python - 删除列中开始的特殊字符python数据框
- meteor - 如何使 Highcharts 与流星 v1.9.3 一起使用
- javascript - Django inlines.js 中的“无法读取未定义的属性‘前缀’”javascript 错误
- c++ - 构造函数后导致这些“意外标记”错误的原因是什么?
- javascript - 我的 Javascript 代码在我将其包装在自调用函数中后不再起作用
- javascript - 摩纳哥编辑器 - “[ts] 未终止的正则表达式文字”
- excel - Excel Count Ifs 取决于 2 列的总和
- google-cloud-platform - 如果我查询 Bigquery 视图,如何计算定价?
- python - 如何创建在其行中包含指定字符串的列列表?
- c# - 更改 AutoFac 默认行为