Offset Center of Google Map
-
I have a google map, with a contact box covering the left hand side of the map. I am looking for code I can add to move the center of the map to the right.
I have used Creative Google Maps App, which has provision to customise the style, and I tried the code listed below, but this did not work (not sure if this is complete code?)
Any suggestions as to how I could offset this map?
Thanks for taking an interest!
___
var center; // a latLng
var offsetX = 0.75; // move center one quarter map width right
var offsetY = 0.5; // centervar span = map.getBounds().toSpan(); // a latLng – # of deg map spans
var newCenter = {
lat: center.lat() + span.lat()*offsetY,
lng: center.lng() + span.lng()*offsetX
};map.setCenter(newCenter);
___
The page I need help with: [log in to see the link]
- The topic ‘Offset Center of Google Map’ is closed to new replies.