在我的应用程序中,我在仪表板上有一张巨大的地图,并且在加载 ajax 内容时我正在放置标记。每个标记都有专门设计的信息框,其中我有一个包含两个类的链接:
- 工具提示
- 花式盒子
在鼠标悬停时,我希望工具提示打开,在鼠标移出时,我希望它关闭,点击时我希望有三件事:
- 要关闭的信息框
- 要打开的fancybox
- 要关闭的工具提示
问题是,在鼠标悬停和鼠标移出时,工具提示按预期运行,但是当我单击链接时,信息框关闭,花式框打开但工具提示没有关闭,它失去了父连接并且永远不会关闭。
这是我的代码:
var infowindow_options = {
content: '...<a class="bind_tooltip">...</a>...',
disableAutoPan: false,
maxWidth: 0,
alignBottom: true,
pixelOffset: new google.maps.Size( 10, 10 ),
zIndex: null,
boxClass: 'info_window',
closeBoxMargin: '10px 10px 0 0',
closeBoxURL: 'http://www.google.com/intl/en_us/mapfiles/close.gif',
pane: 'floatPane',
enableEventPropagation: true,
infoBoxClearance: '10px',
position: mrkr.position
};
google.maps.event.addListener( mrkr, 'click', function() {
infowindow ? infowindow.close() : '';
infowindow = new InfoBox( infowindow_options );
infowindow.open( map );
return false;
} );
google.maps.event.addListener( map, 'click', function() {
if( infowindow ) {
infowindow.close();
$( '.bind_tooltip' ).tooltip( 'close' );
}
return false;
} );
$( document ).tooltip( {
items: '.bind_tooltip',
content: function() {
return $( this ).parent().find( '.tooltip' ).html();
},
position: {my: 'left top+10', at: 'center center'}
} );
我也收到此错误:
错误:无法在初始化之前调用工具提示上的方法;试图调用方法“关闭”