Google Maps 3.0 - Sometimes after removing markers, they stay around...

Posted by ewindsor on Stack Overflow See other posts from Stack Overflow or by ewindsor
Published on 2010-05-04T19:04:19Z Indexed on 2010/05/04 19:08 UTC
Read the original article Hit count: 310

Sometimes when I remove markers they stay around in a "ghost" fashion -- they are clickable but there's no more icon. This is not every time and usually only happens when I remove more than one at a time.

Here's my code for removing markers:

    for(var i in markers) {
       google.maps.event.clearListeners(markers[i], "click");

       markers[i].setMap(null);
       markers[i] = null;

       delete markers[i];
    }

The only way to guarantee that they get removed 100% of the time is to move the map to another position. Then when I move it back they are gone 100% of the time.

Thanks for your help.

© Stack Overflow or respective owner

Related posts about google

Related posts about google-maps-api-3