单击标记野生动物园时弹出窗口未打开 [英] Popup does not open when clicking on marker safari
本文介绍了单击标记野生动物园时弹出窗口未打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在显示来自 django 模型的位置,例如带有弹出窗口的标记:
I am showing position from django model like marker with popup:
我的视图文件
<script>
const MAP_KEY = "{{ MAP_KEY }}";
const added_place_json = JSON.parse('{{ added_place_json | escapejs}}');
</script>
我的 js 文件
for (const place of added_place_json){
L.marker([place.fields.lat, place.fields.long]).bindPopup(
`<div class="card" style="width: 15rem;">
` +
` <h6 class="card-header">Name place:<br>${place.fields.name}</h6>
` +
` <div class="card-body">
` +
` <p class="card-text" style="overflow: scroll">Place comment:<br>${place.fields.comment}</p>
` +
` </div>
` +
`</div>`
).addTo(map)
};
这在 google chrome 上运行良好,但不适用于 safari.当我在 Safari 中单击标记时,什么也没有发生
This works well on google chrome, but it doesn't work on safari. When I click on the marker in safari nothing happens
推荐答案
这是Leaflet 1.7.1的一个bug,见传单#7255
This is a bug of Leaflet 1.7.1, see Leaflet #7255
在最新的传单主版本中,它正在运行,请参阅 问题评论一个>
In the newest master version of leaflet it is working, see Issue Comment
所以我建议您将 Leaflet-src 从 Leaflet Release 1.7.1 更改为 Github 上的 master 分支
So I recommand to change your leaflet-src from the Leaflet Release 1.7.1 to the master branch on Github
这篇关于单击标记野生动物园时弹出窗口未打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文