Skip to content Skip to sidebar Skip to footer

Change Location To Preset Coordinates And Zoom With Click Of A Button

I have a side panel for my google maps api v3 web app and I would like to add the capability to change to a predefined location and zoom when clicking a button. I am thinking javas

Solution 1:

Here's a code snippet:

<script>
function ZoomAndCenter() {
  map.setCenter(new google.maps.LatLng(-34.397, 150.644));
  map.setZoom(15);
}
</script>
<a href="javascript:ZoomAndCenter()">Move to location</a>

Post a Comment for "Change Location To Preset Coordinates And Zoom With Click Of A Button"