I can't tell you the reason for this behaviour, but it may be fixed when you use addListenerOnce
and apply the domready
-listener in the click
-callback of the marker:
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
google.maps.event.addListenerOnce(infoWindow, 'domready', function () {
$('.test-image').click(function () {
alert("Hello World");
});
});
infoWindow.setContent(data.description);
infoWindow.open(map,marker);
});
})(marker, data);