我想隐藏Google Map API中InfoBox Window的关闭按钮,但我不知道如何做到这一点。
CSS代码:
#infobox {
padding: 0 0 8px 0;
margin: -95px 0 0 -15px;
min-width: 180px;
margin-top: 8px;
color: rgb(94, 94, 94);
font-family: Gotham SSm A,Gotham SSm B,Halvetica,sans-serif;
font-size: 12px;
z-index: 1000;
transition: box-shadow .25s;
padding: 1px;
font-size: 12px;
background-color: #ce93d8;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0 0 8px #9c27b0;
box-shadow: 0 0 8px #9c27b0;
}
JavaScript代码:
infobox = new InfoBox({
disableAutoPan: false,
maxWidth: 150,
pixelOffset: new google.maps.Size(-140, 0),
zIndex: null,
boxStyle: {
background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat",
width: "150px"
},
closeBoxMargin: "12px 4px 2px 2px",
closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif", //close button icon
infoBoxClearance: new google.maps.Size(1, 1)
});
答案 0 :(得分:6)
只需将closeBoxUrl
设为""
即可。根据{{3}}:
"
closeBoxURL
:代表关闭框的图片的网址。注意: 默认值是Google标准关闭框的网址。设置这个 如果不需要关闭框,则属性为""
。"
您只需要更改一行:closeBoxURL: ""
。所以你的完整代码看起来像这样:
infobox = new InfoBox({
disableAutoPan: false,
maxWidth: 150,
pixelOffset: new google.maps.Size(-140, 0),
zIndex: null,
boxStyle: {
background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat",
width: "150px"
},
closeBoxMargin: "12px 4px 2px 2px",
closeBoxURL: "", //THE CHANGE
infoBoxClearance: new google.maps.Size(1, 1)
});