开发者

marker wont appear in google maps api v3

开发者 https://www.devze.com 2023-04-12 01:56 出处:网络
google.maps.event.addListener(marker, \'click\', function() { lati=51; longi=9; var latiLongi = new google.maps.LatLng(lati,longi);
google.maps.event.addListener(marker, 'click', function() {
                lati=51;
                longi=9;
                var latiLongi = new google.maps.LatLng(lati,longi);
                var marker1 = new google.maps.Marker({position: latiLongi,icon: imon,title:"51,9"}); 
              });

I have a marker on the map already. On clicking开发者_高级运维 it this marker should display at 51,9. But it doesnt. I am using markerclusterer also in my code, but not with this 51,9 position new marker.


You need to associate the map with your marker1. Something like:

var marker1 = new google.maps.Marker({
    position: latiLongi,
    icon: imon,
    title:"51,9", 
    map:yourmap
});
0

精彩评论

暂无评论...
验证码 换一张
取 消