У меня проблемы с v3 API Карт Google и с использованием плагина InfoBox специально для этого Вариант использования проблемы удобства использования:
Поскольку моя карта требует, чтобы пользовательское информационное окно открывалось при наведении указателя мыши на каждый соответствующий маркер, когда на карте есть 2 маркера, которые находятся близко друг к другу, даже когда / если один из маркеров лежит позади информационного окна, которое в настоящее время открыто после наведения курсора на другой ближайший маркер, оно срабатывает при наведении на него указателя мыши (даже если оно находится за текущим открытым информационным окном), а другое информационное окно препятствует открытому в данный момент / ранее открытому информационному окну
I ' я проследил за процессом вопросов и ответов другой плакат здесь: Google Maps API v3 Событие наведения указателя мыши с помощью плагина InfoBox и следовали рекомендованному коду, но я не могу понять, как предотвратить срабатывание маркеров, лежащих ЗА открытым информационным окном, до тех пор, пока этот информационный ящик закрыт.
var gpoints = [];
function initializeMap1() {
var Map1MileLatLang = new google.maps.LatLng(39.285900,-76.570000);
var Map1MileOptions = {
mapTypeControlOptions: {
mapTypeIds: [ 'Styled']
},
mapTypeControl: false,
zoom: 14,
center: Map1MileLatLang,
//mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeId: 'Styled'
};
var Map1Mile = new google.maps.Map(document.getElementById("map_canvas"), Map1MileOptions);
var styledMapType = new google.maps.StyledMapType(styles, { name: 'Styled' });//new
Map1Mile.mapTypes.set('Styled', styledMapType);//new
for ( var i=0; i<5; i++ ) {
gpoints.push( new point(Map1Mile) );
gpoints.push( new point2(Map1Mile) );
}
function popup(_point) {
_point.popup = new InfoBox({
content: _point.content,
pane: 'floatPane',
closeBoxURL: '',
alignBottom: 1
});
_point.popup.open(_point.marker.map, _point.marker);
google.maps.event.addListener(_point.popup, 'domready', function() {
//Have to put this within the domready or else it can't find the div element (it's null until the InfoBox is opened)
$(_point.popup.div_).hover(
function() {
//This is called when the mouse enters the element
},
function() {
//This is called when the mouse leaves the element
_point.popup.close();
}
);
});
}
function point(_map) {
this.marker = new google.maps.Marker({
position: new google.maps.LatLng(39.291003,-76.546234),
map: _map
});
this.content = 'Just try to click me!
Hovering over this text will result in a mouseout
event firing on the map-popup
element and this will disappear.';
// Scope
var gpoint = this;
// Events
google.maps.event.addListener(gpoint.marker, 'mouseover', function() {
popup(gpoint);
});
}
function point2(_map) {
this.marker = new google.maps.Marker({
position: new google.maps.LatLng(39.295003,-76.545234),
map: _map
});
this.content = 'Just try to click me!
Hovering over this text will result in a mouseout
event firing on the map-popup
element and this will disappear.';
// Scope
var gpoint = this;
// Events
google.maps.event.addListener(gpoint.marker, 'mouseover', function() {
popup(gpoint);
});
}
Поэкспериментировав, я подозреваю, что эта проблема не имеет отношения к z-index ... Правильно ли я понимаю, что это нужно отловить в javascript?
Мы будем очень благодарны за любую помощь или совет!
5
задан Community 23 May 2017 в 12:06
поделиться