将CSS样式标记添加到Google地图 [英] Add CSS styled marker to google maps

查看:154
本文介绍了将CSS样式标记添加到Google地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何将这个动画标记添加到以下google maps API。

Can someone please advise how I could add this animated marker to the below google maps API.

以下是标准的google maps api程式码,可以选择标记(图示)的图片来源。

The below is the standard google maps api code with option to give image source for the marker (icon).

function initialize() {
  var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var mapOptions = {
    zoom: 4,
    center: myLatlng
  }
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      icon: marker.png,         //Option for setting the marker source
      title: 'Hello World!'
  });
}

google.maps.event.addDomListener(window, 'load', initialize);


推荐答案

使用 Google Maps v3的RichMarker - 使用方式:

Use RichMarker for Google Maps v3 - usage:

curMarker = new RichMarker({
    position: new google.maps.LatLng(position),
    map: map,
    content: '<div id="foo">Bar</div>'
});

JSFiddle示例

这篇关于将CSS样式标记添加到Google地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆