How to trigger event only after user stopped using his mouse? Because I don’t want to call my ajax during the zoom (for example, 6 zoom-ins would trigger 6 events, but I need only 1 event, when zoom-in is done)
This function delays the execution, nevertheless, it still executes all events…
google.maps.event.addListener(map, 'center_changed', function() {
// 3 seconds after the center of the map has changed
window.setTimeout(function() {
myfunction());
}, 3000);
});
I solved this problem:
Each time trigger is triggered, I do this:
clearInterval(trigerFunctionVar);trigerFunctionVar=null;And then add new Interval totrigerFunctionVar