Reputation: 77
I'm trying to set use a link on the page to pan and zoom to a specific array of coordinates (where I have a marker already dropped, and gmap3 initialized). When I click the link, the Javascript fires (I get the alert), but nothing happens in my map. Please help. Here is my code:
$(".phila").click(function(){
alert("hello");
$("#map").gmap3({
action:'panTo',
args:[39.952335, -75.163789]
});
});
Edit: now I am getting an error in the console saying "Uncaught Error: panTo: latLng must be of type LatLng"
Upvotes: 3
Views: 4167
Reputation: 5014
To zoom using gmap3 you first need to get a reference to native map object and then simply set the level.
var map = $("#map_canvas").gmap3('get');
map.setZoom(1);
Upvotes: 6
Reputation: 131
you may try this:
$('#test1').gmap3(
{action:'panTo',
args:[new google.maps.LatLng(-7,110)]}
);
it works.
Upvotes: 5
Reputation: 4644
Looks like the expected argument is a single point, not two separate arguments, lat, lon. try:
$("#map").gmap3({
action:'panTo',
args:[[39.952335, -75.163789]]
});
});
Upvotes: 0