Matt
Matt

Reputation: 565

google.maps.event.addListener(map, 'bounds_changed', alert("sth")) only works for the 1st time

google.maps.event.addListener(map, 'bounds_changed', alert("say sth")) only works for the 1st time the map is loaded. After that, no matter how I dragged the map or zoomed the map, the alert didn't pop up.

Same did google.maps.event.addListener(map, 'idle', alert("just pop twice!")).

Upvotes: 0

Views: 1167

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117354

wrap the alert into a function:

google.maps.event.addListener(map, 'idle', function(){alert("just pop twice!")})

Upvotes: 1

Related Questions