0

不敢相信没有一个简单的答案,需要这张地图自动平移或以其他方式阻止信息窗口从地图顶部消失......

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

代码...

    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 = "info-window">';
        contentString += '<div class = "float-left"><h1>Get in touch</h1></div>';
        contentString += '<div class ="divider4"><!--div--></div>';
        contentString += '<div class = "float-left">';
            contentString += 'Riverside House,<br>Quarry Road,<br>Chipping Sodbury,<br>Bristol BS37 6AX,<br>United Kingdom';
        contentString += '</div>';
        contentString += '<div class ="divider4"><!--div--></div>';
        contentString += '<div class = "float-left">';
            contentString += '<span class = "grey">t&nbsp;+44 (0)1454 311 220</span><br><a href ="mailto:info@triangledesign.biz" class = "grey">info@triangledesign.biz</a>';
        contentString += '</div>';
    contentString += '</div>';

    var image = new google.maps.MarkerImage("cup-sm.png",
    // This marker is 20 pixels wide by 32 pixels tall.
    null, 
    // The origin for this image is 0,0.
    new google.maps.Point(0,0)
    // The anchor for this image is the base of the flagpole at 0,32.

);


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

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

    $(document).ready(function(){
      infowindow.open(map,marker);
    });
4

1 回答 1

1

好吧,只需更改center变量myOptions属性中的纬度。

将中心设置在南侧。

我认为没有其他解决方案,因为信息窗口大于地图的一半。

于 2012-10-03T10:58:59.053 回答