使用设置了 htmlContent 属性的图钉创建 map 时,当图钉离开 map 区域时(例如:放大然后缩小),事件可能会解除绑定(bind)。
重新创建的步骤:
加载 map 单击图钉(应提醒) 放大 map 上的任意位置,使图钉不再出现在 map 上 缩小 再次点击图钉(将不再提醒) 当图钉未设置 htmlContent 属性时,不会发生这种情况。
我在这里创建了演示:
损坏的示例:http://jsfiddle.net/wYddq/3/
var pushpinOptions = {width: null, height: null, htmlContent: "<div style='font-size:12px;font-weight:bold;border:solid 2px;background-color:LightBlue;width:100px;'>Custom Pushpin</div>"};
工作示例:http://jsfiddle.net/wYddq/4/
var pushpinOptions = {width: null, height: null};
在 Chrome 24(W7 和 OSX)、IE9 (W7) 和 IE10 (W8) 中测试,结果相同。
最佳答案
Bing map 论坛中似乎有一个解决方案:http://social.msdn.microsoft.com/Forums/en-US/ef4b7ef1-d53e-4385-9e58-775c6a028ebe/bing-maps-custom-html-pushpin-not-firing-any-infobox-event
关于javascript - Bing Maps v7 图钉 htmlContent 导致事件在不可见时变为未绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14756603/