Okay I'm much closer now. Well - it's working (on chrome at least).
This is all within createMarker:
google.maps.event.addListener(marker, 'click', function() {
infobox.setContent ("<div class=\"map_box\">Hello</div>");
infobox.open(map, marker);
google.maps.event.addListener(infobox, 'domready', function() {
$(".map_box").click(function() {
var myLatLng = new google.maps.LatLng(lat, lng);
map.panTo(myLatLng);
});
});
});
My only concern is that if I replace the panTo with an alert(lat) to
test this, then I receive an extra alert on each click (so first
marker click 1 alert popup - great. second marker click two alerts,
third marker click three alerts etc.), so I think something still
isn't quite right? I guess I need to clear the event listener after
each click somehow?
Thanks