Reputation: 13378
I probably don't know the keywords to search, and am not able to google for a solution so far.
Let's say a map div is 200px x 200px (width x height). When we display Google Maps, the map is automatically centered, where the marker is at the center of the map, roughly the marker appear at 100px x 100px coordinates.
How can I move the map to show the marker 20px from left, say 20px x 100px coordinates?
Thanks.
Upvotes: 2
Views: 2594
Reputation: 13378
Stupid me. The center
in map options suffices:
https://developers.google.com/maps/documentation/javascript/reference#MapOptions
var centerLatLng = new google.maps.LatLng(100.0001, 90.001 + 0.003);
var myOptions = {
center: centerLatLng,
};
The + 0.003
will align the focus to the left horizontally. Play around with the coordinates to align the focus.
Upvotes: 4