Google Maps API v3: search for map in a container
I have multiple Google Maps on a page. After I initialized them, I have a 开发者_StackOverflow社区need to change options for one, which is in a particular container. So, as I understand, I need to get a variable, which contains the link to this map.
The question is: how can I get the link for the google map if I know its container (for example, $("#map1")
)?
you can use this
var latlng = new google.maps.LatLng(x, y);
var mapOptions = {
center: latlng,
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map1"), mapOptions);
精彩评论