var map; function initialize(...">

How can I call this method only after the user actually stops panning or zooming?

<script type="text/javascript">
var map;

function initialize()
{
    /* ... */

    google.maps.event.addListener(map,'idle',function()
    {
        /* do something here */
    });
}
</script>

<body onload="initialize()"> 
    <div id="map_canvas"></div> 
</body>

How can I make sure that the content in google.maps.event.addListener(map, 'idle', function() does not start right after the page loads?

I want it to work only after the user has actually stopped panning or zooming.

I also tried moving it out of function initialize, but that, of course, didn't work either.

0
source share
1 answer

add idle listener after dragstart event was fired

var map;

function initialize(){

    /* ... */

    google.maps.addListenerOnce(map, "dragstart",function(event){
        google.maps.addListenerOnce(map, "idle", function(event2){
            /* ... */
        });
    }
}
+1
source

All Articles