disable clickable landmark on google map

后端 未结 6 654
粉色の甜心
粉色の甜心 2020-12-03 06:56

I\'m using google map API v3. I want to disable click action on default google landmark/poi. For example, when I zoom to UCLA, the school icon shows up (that\'s fine) but I

6条回答
  •  青春惊慌失措
    2020-12-03 07:48

    I understand that this question is old, but maybe this answer will help others:

    I'm not sure if this is legal, but I ended up exploring the code and made this:

    $("#google-map").on("mousedown",function(){
        setTimeout(function(){
            disableInfoWindows();
        },500);
    });
    
    function disableInfoWindows()
    {
        $(".gm-iw.gm-sm").parent().parent().remove();
        $("[style='position: absolute; left: -2px; top: -336px; width: 59px; height: 492px; -webkit-user-select: none; border: 0px; padding: 0px; margin: 0px;']")
        .parent()
        .parent()
        .remove();
    }
    

    It worked for me, no infoWindow showing up, while preserving all the icons. Anyone who has an idea enhancing the code is welcome, the infoWindow is showing up just a bit the first time it is about to open, after that first one, it is completely gone.

提交回复
热议问题