gpt4 book ai didi

javascript - 传单弹出窗口和标签超出​​ map 划分

转载 作者:行者123 更新时间:2023-11-28 07:11:18 29 4
gpt4 key购买 nike

我在传单标记上使用弹出窗口,并使用背景作为固定大小的图像。每当标记放置在 map 的一 Angular ,然后我单击标记以显示弹出窗口时,它会稍微移动整个 map 几分之一秒,然后弹出消息会超出 map 屏幕。如何解决这个问题。

var content = 'Hi everybody I am here. How are you? Please resolve this.';
L.marker([-67, 265.5]).bindPopup(content).addTo(map);
L.marker([-21.5, 99.5]).bindPopup(content).addTo(map);

我已经为此创建了一个 fiddle :-

Inline Link

最佳答案

我能理解的是,当 popup 打开时, map 不应自动平移。简单的方法是在 popup 选项中设置 autoPan:false。因此,以这种方式创建标记

L.marker([-67, 265.5]).bindPopup(content,{autoPan:false}).addTo(map);

关于javascript - 传单弹出窗口和标签超出​​ map 划分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31283998/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com