信息框无法将位置正好位于标记上方 [英] Infobox cant postion exactly above the marker

查看:75
本文介绍了信息框无法将位置正好位于标记上方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用了自定义信息框,并且无法将信息框定位在标记的正上方

I have used customized infobox here and cant position infobox exactly above the marker,

链接:

http://jsfiddle.net/uGnQb/6/

var myMapOptions = {
          zoom: 15,
          center: secheltLoc,
          mapTypeId: google.maps.MapTypeId.ROADMAP,    
};

请先单击第一个标记,您会看到在信息框中,标记的位置正好位于标记上方,但是第二个标记的信息框并未位于标记的正上方.

Pleae click on the first marker, you can see that in infobox will position exactly above the marker, but infobox for the second marker is not positioning exactly above the marker.

请帮助我吗?

推荐答案

在创建您的InfoBox对象集并将pixelOffsetalignBottom调整为true时:

When creating your InfoBox object set and adjust pixelOffset and alignBottom to true:

var htmlInfoWindow = new InfoBox({
      content: "",
      closeBoxURL: "",
      position: marker.getPosition(),
      pixelOffset: new google.maps.Size(-100, -250),
      alignBottom: true
});

请注意,所有信息框的高度和宽度必须相同

Please, note the height and width must be the same for all infoboxes

这篇关于信息框无法将位置正好位于标记上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆