谷歌地图API v3 infowindow不显示

时间:2012-10-02 19:19:20

标签: google-maps-api-3

无法理解为什么信息窗口不会显示在此页面上...

http://www.triangledesign.biz/contact-dev.php

还注意到谷歌示例没有信息窗口......

https://google-developers.appspot.com/maps/documentation/javascript/examples/infowindow-simple

...代码

    var mapOptions = {
      center: new google.maps.LatLng(51.539104, -2.400264),
      zoom: 16,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

    var image = 'cup-sm.png';
    var myLatLng = new google.maps.LatLng(51.539104, -2.400264);
    var contentString = '<div id="content" style = "width:100px;height:100px;background:white">test content</div>';


    var marker = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title:"Get In Touch",
          icon: image
      });

    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });

    google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map,marker);
    });

0 个答案:

没有答案