Google maps api 3 信息气泡在标记上的位置错误

Google maps api 3 信息气泡在标记上的位置错误,google-maps-api-3,infobubble,Google Maps Api 3,Infobubble,我有一个谷歌地图,只有一个标记和一个信息泡泡。单击标记时会出现信息气泡。问题在于,信息泡沫出现在标记上,而不是它的上方。请参见屏幕截图: infoBubble已关闭: infoBubble已打开: 这是代码,我使用geocoder,因为我只有指定的地址: geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK)

我有一个谷歌地图,只有一个标记和一个信息泡泡。单击标记时会出现信息气泡。问题在于,信息泡沫出现在标记上,而不是它的上方。请参见屏幕截图:

infoBubble已关闭: infoBubble已打开: 这是代码,我使用geocoder,因为我只有指定的地址:

geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var myOptions = {
                zoom: 14,
                center: results[0].geometry.location,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

            var marker = new google.maps.Marker({
                map: map,
                position: results[0].geometry.location
            });

            //i am using simple InfoBubble initialization
            var infoBubble = new InfoBubble(
                {
                    map: map,
                    content: "<h2>"+name+"</h2><div>"+street+"</div><div>"+city+", "+zip+"</div>"
                });


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

        }
    });
geocoder.geocode({'address':address},函数(结果,状态){
if(status==google.maps.GeocoderStatus.OK){
变量myOptions={
缩放:14,
中心:结果[0].geometry.location,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
map=new google.maps.map(document.getElementById(“map_canvas”),myOptions);
var marker=new google.maps.marker({
地图:地图,
位置:结果[0]。几何体。位置
});
//我使用的是简单的InfoBubble初始化
var infoBubble=新的infoBubble(
{
地图:地图,
内容:“+name+”“+street+”“+city+”、“+zip+”
});
google.maps.event.addListener(标记,'click',函数(e){
打开(地图、标记);
});
}
});

有什么线索可以解释为什么会发生这种情况吗?

在创建infoBubble时使用
映射选项。

我觉得这个示例非常方便[http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html][1] ,请尝试下面的代码段

var map, infoBubble;
      function init() {
        var mapCenter = new google.maps.LatLng(-35.397, 150.644);
        map = new google.maps.Map(document.getElementById('map'), {
          zoom: 8,
          center: mapCenter,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        var marker = new google.maps.Marker({
          map: map,
          position: new google.maps.LatLng(-35, 150),
          draggable: true
        });

        infoBubble = new InfoBubble({
          maxWidth: 300
        });

        infoBubble.open(map, marker);

        infoBubble.setContent('This is a sample content') //Please set your content here.

        google.maps.event.addListener(marker, 'click', function() {
          if (!infoBubble.isOpen()) {
            infoBubble.open(map, marker);
          }
          });

      }
      google.maps.event.addDomListener(window, 'load', init);
}


  [1]: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html