GMaps V3 InfoWindow - disable the close “x” button

前端 未结 22 1022
青春惊慌失措
青春惊慌失措 2020-12-05 09:14

From what I see, in v2 of GMaps API there was a property \"buttons\" of the InfoWindow object that one could define in a way that given InfoWindow has no close button:

22条回答
  •  無奈伤痛
    2020-12-05 10:17

    My own way (without Jquery) and with realign to the center of the infoWindow:

    var content = document.querySelector('.gm-style-iw');
    content.parentNode.removeChild(content.nextElementSibling);
    content.style.setProperty('width', 'auto', 'important');
    content.style.setProperty('right', content.style.left, 'important');
    content.style.setProperty('text-align', 'center', 'important');
    

提交回复
热议问题