Je suis fatiguée de chercher comment appliquer fermer le clic événement en infobox(google maps) . J'ai essayé presque tous les scénarios auxquels je peux penser, mais sans succès. Je vous prie de bien vouloir m'aider
Voici mon code pour l'ajout d'un marqueur :-)
var ib_click = new InfoBox();
ib_click.isOpen = false;
var toShowHover = true;
function add_marker(lat,lng,icn,title,box_html) {
var mapcode,myOptions;
var marker = new google.maps.Marker({
/*marker settings*/
});
myOptions = {
/*option of infobox*/
};
marker.ibOptions = myOptions;
google.maps.event.addListener(marker, 'click', function() {
mapcode = /* html for showing box */
myOptions.content = mapcode;
myOptions.boxStyle.width = "235px";
ib_click.setOptions(marker.ibOptions);
ib_click.open(map, marker);
ib_click.isOpen = true;
toShowHover = false;
});
google.maps.event.addListener(marker, 'mouseover', function() {
//this is fired
var mapcode = /*html for showing hover*/;
//ib_click.open(map, marker);
myOptions.content = mapcode;
myOptions.boxStyle.width = "205px";
ib_click.setOptions(marker.ibOptions);
ib_click.open(map, marker);
// ib_click.isOpen = true;
});
google.maps.event.addListener(marker, 'mouseout', function() {
//alert('mouse out');//this is fired
//toShowHover = true;
});
google.maps.event.addListener(ib_click, 'closeclick', function(){
//how to use closeclick
//showing error here
alert('closed');
});
return marker;
}
Merci de nous éclairer Ankur ;(