google map infobox position

∥☆過路亽.° 提交于 2019-12-19 06:03:28

问题


I've been googling that question for some time and all I got is headache. I add google marker with infobox on my google map, but the infobox is located lower than marker, how ever I would really appreciate it to be over the marker. Does anyone know how to do it?

And please don't gove some links to somewhere, I was seeing it for a loooong time today. Thank you in advance.


回答1:


set the alignBottom-property of the infoBox to true (default is false). For further adjustments of the position use the pixelOffset-property of the infoBox




回答2:


By default the infoBox will point the bottom left of the marker. You can simply do this:

var ib= new InfoBox({
    ....//other properties,
    pixelOffset: new google.maps.Size(-25, 0) //where your marker's height is 25px
});



回答3:


infobox = new InfoBox({
         content: document.getElementById("infobox"),
         disableAutoPan: false,
         maxWidth: 150,
         pixelOffset: new google.maps.Size(-140, -45),
         zIndex: null,
         boxStyle: {
            background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') 0% 100% no-repeat",
            opacity: 0.75,
            width: "280px"
        },
        infoBoxClearance: new google.maps.Size(1, 1),
        alignBottom: true
    });


#infobox {
    border:2px solid black;
    margin-bottom: 8px;
    background:#333;
    color:#FFF;
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    padding: .5em 1em;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    border-radius: 2px;
    text-shadow:0 -1px #000000;
    -webkit-box-shadow: 0 0  8px #000;
    box-shadow: 0 0 8px #000;
}

// Load the customized arrow from local



来源:https://stackoverflow.com/questions/14938939/google-map-infobox-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!