【问题标题】:Google Maps API 3 - onclick urlsGoogle Maps API 3 - onclick url
【发布时间】:2015-03-22 11:30:45
【问题描述】:

我在 phonegap 应用程序中使用 google maps api。

当您单击已知的 google 位置时,它会在这些默认信息窗口中显示一个包含详细信息/网站/网址等的信息窗口,我想覆盖元素的 onclick,因为我希望它们在外部浏览器中打开。

我曾尝试使用 jquery 来查找元素,但它不会绑定,因为 html 是动态注入的。有没有我可以绑定的地图事件或简单的方法?

干杯 尼罗

【问题讨论】:

标签: jquery google-maps google-maps-api-3


【解决方案1】:

1) 先设置这个

var set = google.maps.InfoWindow.prototype.set;
    google.maps.InfoWindow.prototype.set = function (key, val) {
        if (key === 'map' && ! this.get('noSuppress')) {
            //console.warn('This InfoWindow is suppressed.');
            //console.log('To enable it, set "noSuppress" option to true.');
            return;
        }
        set.apply(this, arguments);
    }

2) 对于您打开的任何信息窗口,请确保您传入“noSupress”参数

 infowindow.set('noSuppress', true);

【讨论】:

    猜你喜欢
    • 2016-10-31
    • 1970-01-01
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多