Javascript 谷歌地图信息框,关闭按钮似乎不起作用
我正在开发一个谷歌地图应用程序,使用谷歌的infobox插件,我遇到了一些麻烦 似乎“关闭”按钮不再想在信息框上工作,这很奇怪,因为我以前确实让它工作过,因为我正在将一个kiosk应用程序转变为一个web应用程序。我使用了一个自定义的关闭按钮,但即使我切换到谷歌默认的关闭按钮,我也会得到相同的结果。仅当您单击地图上的另一个标记以打开另一个信息框时,信息框才会关闭。一旦打开,似乎不可能将其移除。代码尚未从kiosk更改为此应用程序的web版本 下面是我用来实例化标记的一些代码:Javascript 谷歌地图信息框,关闭按钮似乎不起作用,javascript,google-maps-api-3,google-maps-markers,Javascript,Google Maps Api 3,Google Maps Markers,我正在开发一个谷歌地图应用程序,使用谷歌的infobox插件,我遇到了一些麻烦 似乎“关闭”按钮不再想在信息框上工作,这很奇怪,因为我以前确实让它工作过,因为我正在将一个kiosk应用程序转变为一个web应用程序。我使用了一个自定义的关闭按钮,但即使我切换到谷歌默认的关闭按钮,我也会得到相同的结果。仅当您单击地图上的另一个标记以打开另一个信息框时,信息框才会关闭。一旦打开,似乎不可能将其移除。代码尚未从kiosk更改为此应用程序的web版本 下面是我用来实例化标记的一些代码: var displ
var displayingInfoBox;
// Options for the infobox
var popoverOptions = {
disableAutoPan : false,
maxWidth : 0,
closeBoxMargin : '8px 32px',
closeBoxURL : 'url/to/close_button/image.png',
infoBoxClearance : new google.maps.Size(50,50),
isHidden : false,
enableEventPropagation : true,
boxStyle: {
border : 'none',
opacity : 1.0,
background : "transparent url( 'url/to/background/image.png' ) no-repeat 0 0",
width: "266px",
height: "109px"
}
};
// Add listener to the marker to open the overlay -- where popupInfo is the content to display inside the popover and marker is the marker on the map
google.maps.event.addListener(marker, 'click', function( event ) {
createOverlay( marker, popupInfo, new google.maps.Size(-35, -235))
});
// Method to show in the overlay
function createOverlay(marker_, content_, offset_) {
// close the previous overlay if there was one.
VW.Map.closeInfoBox();
// set the provided content to the popover options
popoverOptions.content = content_;
popoverOptions.pixelOffset = offset_;
// use the infobox lib to create an overlay
displayingInfoBox = new InfoBox(popoverOptions);
// show the overlay over the marker passed in
displayingInfoBox.open(myMap, marker_);
// return in case the caller wants to do something with this.
return displayingInfoBox;
}
非常感谢您的帮助
提前谢谢
编辑——我使用的是INFOBOX API,而不是maps API中的InfoWindow对象。这就是我要说的:
格雷厄姆我有这个问题。在Javascript中,我使用了我的主CSS样式表来设置infobox的样式,而不是boxStyle。当我在1.0以外的任何地方设置不透明度时(或完全删除),关闭按钮将可见,但不起作用。我的建议是检查以确保您的信息框不会从其他地方继承不透明度。我遇到了这个问题。在Javascript中,我使用了我的主CSS样式表来设置infobox的样式,而不是boxStyle。当我在1.0以外的任何地方设置不透明度时(或完全删除),关闭按钮将可见,但不起作用。我的建议是检查以确保您的信息框不会从其他任何地方继承不透明性