【问题标题】:GoogleMaps: no custom Icon in IE7GoogleMaps:IE7 中没有自定义图标
【发布时间】:2011-08-22 07:35:55
【问题描述】:

我尝试为我的地图上的标记使用自定义图标。
它在 FF 和 IE8 上运行良好,但 IE7 只显示默认的 google 标记。

为了创建标记,我使用 Class LabeledMarker,
图片是文件类型image/PNG。

此代码用于创建标记:

var icon = new GIcon();
icon.image = this.options.icon;
icon.iconSize = new GSize(24, 24);
icon.iconAnchor = new GPoint(12, 12);
icon.infoWindowAnchor = new GPoint(12, 0);

point = new GLatLng(this.data['geo_n'], this.data['geo_o']);

var opts = {
    icon: icon,
    clickable: false,
    labelText: 'test'
};

marker = new LabeledMarker(point, opts);
map.addOverlay(marker)

【问题讨论】:

    标签: javascript internet-explorer-7 png google-maps-markers google-maps-api-2


    【解决方案1】:

    好的,问题是别的。 我知道我讨厌 IE 中的 for 循环。

    有一个 for 循环遍历配置数组以找到要显示的正确图标。
    for(i in cfg.icons[key]){
    像这样在第一次迭代中我有值'rgbToHex'并导致我的脚本中止

    用这个替换我的所有脚本现在都很好用:
    for(var i = 0; i

    【讨论】:

      猜你喜欢
      • 2021-04-25
      • 2015-03-07
      • 2011-04-17
      • 1970-01-01
      • 2022-01-08
      • 2017-06-04
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      相关资源
      最近更新 更多