jQuery的Google地图插件 GMAP3

所属分类:媒体-地图

 41505  289  查看评论 (0)
分享到微信朋友圈
X
jQuery的Google地图插件 GMAP3 ie兼容10

GMAP3 插件用来将Google Maps插入到网页中,Google在其产品中已经提供了很简便的方法。但是GMAP3这个jQuery插件提供了更加简便的方法,特别是在使用一些高级功能时(如:overlays和callbacks)

本示例显示使用集群功能的列表。

而Mac Donald的列表存储在一个JSON对象。

要渲染集群,这个例子使用在CSS文件中定义了一些类(群集cluster-1,集群2,集群3)。

尽量放大,并在进出的标记移动鼠标。

$("#test").gmap3({
  map:{
    options: {
      center:[46.578498,2.457275],
      zoom: 5,
      mapTypeId: google.maps.MapTypeId.TERRAIN
    }
  },
  marker: {
    values: macDoList,
    cluster:{
      radius:100,
      // This style will be used for clusters with more than 0 markers
      0: {
        content: "<div class='cluster cluster-1'>CLUSTER_COUNT</div>",
        width: 53,
        height: 52
      },
      // This style will be used for clusters with more than 20 markers
      20: {
        content: "<div class='cluster cluster-2'>CLUSTER_COUNT</div>",
        width: 56,
        height: 55
      },
      // This style will be used for clusters with more than 50 markers
      50: {
        content: "<div class='cluster cluster-3'>CLUSTER_COUNT</div>",
        width: 66,
        height: 65
      }
    },
    options: {
      icon: new google.maps.MarkerImage("http://maps.gstatic.com/mapfiles/icon_green.png")
    },
    events:{
      mouseover: function(marker, event, context){
        $(this).gmap3(
          {clear:"overlay"},
          {
          overlay:{
            latLng: marker.getPosition(),
            options:{
              content:  "<div class='infobulle"+(context.data.drive ? " drive" : "")+"'>" +
                          "<div class='bg'></div>" +
                          "<div class='text'>" + context.data.city + " (" + context.data.zip + ")</div>" +
                        "</div>" +
                        "<div class='arrow'></div>",
              offset: {
                x:-46,
                y:-73
              }
            }
          }
        });
      },
      mouseout: function(){
        $(this).gmap3({clear:"overlay"});
      }
    }
  }
});


相关插件-地图

百度地图区域选择

百度地图多边型覆盖物对区域进行覆盖选择和自定义覆盖物
  地图
 39991  318

根据经伟度坐标获取地址

根据经伟度坐标获取地址
  地图
 48299  341

一款基于百度地图API做成的地区地图

可根据xml返回的数据控制插件,也可以本地控制插件、地区三级级联查询、地区联动地图的插件,在线搜索
  地图
 77665  565

省市区三级联动结合百度地图查询位置

全国各地省市区三级联动,手动输入地址结合百度地图查询位置
  地图
 30315  352

讨论这个项目(0)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复