1

Possible Duplicate:
get current latitude and longitude from gps enabled device

I use the gmap3 of http://gmap3.net. I want to get the latitude, longitude, and zoom on the change event. This api has a get:

http://gmap3.net/api/get.html

But i try $('.gmap_widget').gmap3('get','map');

and returns a doom node '.gmap_widget'

4

1 回答 1

2

$('.gmap_widget').gmap3('get','map');是错的

正确的形式是$('.gmap_widget').gmap3({action:'get',name:'map'});

代码是:

   map=$('.gmap_widget').gmap3({action:'get',name:'map'});
   center=map.getCenter();
   lat=center.lat();
   lng=center.lng();
   zoom=map.getZoom(); 

新 API 将使用以下内容:

var map = $(".gmap_widget").gmap3({ 
  get: {
    name:'map',
    callback: function(map){ 
       center=map.getCenter();
       lat=center.lat();
       lng=center.lng();
       zoom=map.getZoom();  
  }} 
});
于 2012-10-11T21:32:06.693 回答