180
rated 0 times
[
187]
[
7]
/ answers: 1 / hits: 49211
/ 9 Years ago, fri, february 13, 2015, 12:00:00
I am using Google Map API v3 and jQuery 1.11.0.
I have a Google Map in the following div:
<div id=googleMap class=map_div></div>
The map.js is outside html file, it is linked.
Now I have a button in another part of the html (outside map) like this:
<button id=3>Change center</button>
Now I want to add a on click event which will change the center of the map to new latitude and longitude.
So, I have JavaScript in HTML like this:
<script>
$(document).ready(function()
{
$(#3).click(function(){
var center = new google.maps.LatLng(10.23,123.45);
map.panTo(center);
});
});
</script>
Can anyone help me please? Thanks in advance for helping.
More From » jquery