Adding an onclick event to google.map marker

前端 未结 6 555
说谎
说谎 2020-12-24 02:20

I\'m stuck trying to figure out a little bit of JS :( I have a google map

var myCenter=new google.maps.LatLng(53, -1.33);

function initialize()
{
var mapPro         


        
6条回答
  •  隐瞒了意图╮
    2020-12-24 02:36

    Not sure where your content is but you would need to do the following...

    var yourContent = new google.maps.InfoWindow({
        content: 'blah blah'
    });
    
    google.maps.event.addListener(marker, 'click', function() {
      yourContent.open(map,marker);
    });
    

提交回复
热议问题