jquerybing映射窗口标记未触发的点击事件

jquery-bing-maps click event not triggered from window marker

本文关键字:事件 映射 窗口 jquerybing      更新时间:2023-09-26

我正试图从Bing地图上的Window标记中的链接触发事件然而,当我点击链接时,我会被重定向到一个新页面,而不是让JS将函数绑定到事件

$('.single_address').live('click', function (evt) {
    alert('test');
    return false;
});

for (var i = 0; i < locations.length; i++) {
 (function (i) {
   var location_id = locations[i].aid;
   var address_street = locations[i].d;
   // var self = this;
   self.addMarker({
    'location': locations[i].la + ',' + locations[i].lo,
    'bounds': true
   }).click(function () {self.openInfoWindow({
    'title': address_street,
    'description': '<div class="single_address"><a href="test.php#list1">Contacts at this address</a></div>'
            }, this);
        });
    })(i);
}

所以基本上没有显示警报消息,但页面被重定向到test.php

使用jquery-1.8.2和jquery Mobile 1.2

好吧,我已经设法让它工作了,我不确定我试图做的是什么可以实现

我已经关注了Bing地图文档http://msdn.microsoft.com/en-us/library/gg675210.aspx

可以通过在titleClickHandler属性中指定事件处理程序使标题可单击或者,添加带有操作属性的标签

  var infoboxOptions = {
         title:'My Infobox',
         description:'Testing actions',
         actions:[
          {label: 'test1', eventHandler: testEvent1},
          {label: 'test2', eventHandler: testEvent2}
         ]
   };