I\'m having a problem finishing off my script, it works using map.setCenter to reposition on each marker, but I would like to pan to each new marker. However, when I use the pan
One reason for this problem are undefined variables lat
and lng
at the beginning of initialize()
method:
function initialize() {
latlng = new google.maps.LatLng(lat, lng);
mapOptions = {
...
lat
and lng
have to be defined to some values. For example:
function initialize() {
lat = 47.89;
lng = 13.45;
latlng = new google.maps.LatLng(lat, lng);
...
The other problem is that at the end of code there is a call:
google.maps.event.addDomListener(window, 'load', initialize);
which should be commented out.