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

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

问题描述

有人可以告诉我如何将这个动画标记添加到下面的谷歌地图 API 中.

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

以下是标准的谷歌地图 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);

推荐答案

使用 RichMarker for Google Maps v3 - 用法:

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

JSFiddle 示例.

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

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