Prevent Google Maps from Closing from Closing

If certain conditions are met when the info window is closed, I want to prohibit the default closing event that will be fired. Can this be achieved? I tried several things like:

  • Stop event propagation
  • returns false from the callback method
  • there are no methods / properties open with infoWindow that prevent closing.

Please let me know if possible.

0
source share
3 answers

InfoWindow . , , InfoBox Utility Library, . InfoBoxOptions api-doc :

enableEventPropagation, , , InfoBox: mousedown, click, dblclick contextmenu InfoBox ( false, google.maps.InfoWindow)., true, InfoBox . iPhone:. ; .

0

, , closeclick, .

- , , : x, , , . . . , .close().

!

var a=document.getElementById('map_canvas');
var b=a.getElementsByTagName('img');
var i, j=b.length;
for (i=0; i<j; i++) {
  if(b[i].src.match('imgs8.png')){
    if(b[i].style.left=='-18px') {
      c=b[i].parentElement.parentElement;
      console.log(c);
      if(c.innerText.match("Map data")) {
        console.log('no');
      } else {
        b[i].parentElement.removeChild(b[i]);
      }
    }
  }
}

. [x], .

EDIT:

0

You can always listen to the close event and then throw a javascript error so that it does not close. Example:

google.maps.event.addListener(my_infoWindow, 'closeclick', function(e){
    // Throw an error to stop the close
    throw "stop close";
})
0
source

All Articles