google 地图 - 在点击事件发生时或之后修改信息窗口 css

google maps - modify infowindow css on or after click event

在 Google 地图上,我想在显示信息窗口之前调整信息窗口的初始布局。具体来说,我想在单击 eventL

时或之后执行此操作
            // on click             
            $(".tabs").hide();
            $("#summary").show();

这是点击标记时(成功)创建信息窗口的代码。我需要找到在哪里添加上面的代码和事件来放置它。

        // Renders the marker on the specified map
        marker.setMap(map); 

        // create an InfoWindow
        var infoWnd = new google.maps.InfoWindow();         

        // add content to your InfoWindow
        infoWnd.setContent('<div class="scrollFix">' + infoWindowContent);

        // add listener on InfoWindow - close last infoWindow  before opening new one 
        google.maps.event.addListener(marker, 'click', function() {

            //Close active window if exists 
            if(activeInfoWindow != null) activeInfoWindow.close();

            // Open InfoWindow
            infoWnd.open(map, marker);

            // Store new open InfoWindow in global variable
            activeInfoWindow = infoWnd;

            ....

尝试在 'domready' 事件的 InfoWindow 上放置一个侦听器。触发时,将您的更改应用到 InfoWindow 的内容。

        // Renders the marker on the specified map
        marker.setMap(map); 

        // create an InfoWindow
        var infoWnd = new google.maps.InfoWindow();         

        // put a listener of InfoWindow, when "domready", make changes to content
        google.maps.event.addListener(infoWnd, 'domready', function() {
            $("span.tabs").hide();
            $("#summary_tab").show();                       
        });

        // add content to your InfoWindow
        infoWnd.setContent('<div class="scrollFix">' + infoWindowContent + "<div>");


        // add listener on InfoWindow for CLICK event- close last infoWindow  before opening new one 
        google.maps.event.addListener(marker, 'click', function() {


            //Close active window if exists
            if(activeInfoWindow != null) activeInfoWindow.close();

            // Store new open InfoWindow in global variable
            activeInfoWindow = infoWnd;

            // Open InfoWindow
            infoWnd.open(map, marker);              
        });