Wim
Wim

Reputation: 213

google maps dragend event undefined while click works

hi so I'm trying to get a hold of the dragend event

map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

google.maps.event.addListener(map,'dragend',function(event) {
//stuff
});

now the odd thing is when i use this event listener "event" is undefined, but if i for instance replace "dragend" with "mouseup", then i get a defined event in my function . does anybody know why this is and how i can get get a hold of the dragend event?

Upvotes: 0

Views: 513

Answers (1)

geocodezip
geocodezip

Reputation: 161384

According to the documentation the dragend event doesn't have any arguments to its callback function:

dragend
Arguments: None This event is fired when the user stops dragging the map.

You can use other functions inside the callback when dragging ends (i.e. map.getCenter() will get the new center of the map)

Upvotes: 2

Related Questions