2012-02-10 58 views

回答

1

我无法找到v3插件的gmap。你能添加一个链接吗?如果您使用的gmap for v2 plugin,您可以使用setCenter功能,而不是哑剧功能:$('#map_canvas').gmap('get', 'map').setCenter(myLatlng, myZoom);

如果GMAP VOR V3插件公开第3版API,那么你可以拨打电话进行呼叫,以哑剧后setZoom 。

澄清插件源后更新时间:

的插件有这样做,一个内置的方法:centerAt。您不需要使用地图div获取jQuery对象,因为这是DOM对象的容器,而不是google.maps.Map对象。 I.E.它不会有panTo方法。这里是你如何recenter /变焦,插件作者的意图的方式(假设myLatlng你提到的是一个google.maps.LatLng):

// initialize the map 
$('#map_canvas').gMap(); // this can take a ton of options if you want. 

再后来......

// reposition/zoom the map. 
$('#map_canvas').gMap('centerAt', { 
    latitude: myLatlng.lat(), 
    longitude: myLatlng.lng(), 
    zoom: myZoom 
}); 
+1

的http://实验室.mario.ec/jquery-gmap /#示例 – jcvegan 2012-02-22 23:03:58

+0

好的,更新我的回答作为回应。希望能帮助到你。 – DaveS 2012-02-23 16:00:26