Google Maps: Event Listener only remembering final value of variable

前端 未结 1 1788
孤城傲影
孤城傲影 2021-01-23 03:37

I\'m putting together a Google Map which contains the locations of various test centres around my country. It plots a marker on each county, and when you click the county marker

相关标签:
1条回答
  • 2021-01-23 04:03

    Cheers, I changed the event handler to the following and it worked:

    GEvent.addListener(marker, "click",
        (function(key) {
            return function() {
                // Zoom to county
                showCounty(key);
            };
        })(key)
    );
    
    0 讨论(0)
提交回复
热议问题