Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:22:44+00:00 2026-06-17T12:22:44+00:00

I have a GoogleMaps APIv3 application in which multiple InfoWindows can be open at

  • 0

I have a GoogleMaps APIv3 application in which multiple InfoWindows can be open at any one time. I would like to be able to bring an obscured InfoWindow to the front of all other InfoWindows if any part of it is clicked – similar to the behaviour of windows in MS Windows OS.

I had thought to add an onclick event handler which increases the z-index of the InfoWindow, but the event handler does not appear to be firing.
ZIndex is a global variable that keeps increasing as InfoWindows are clicked – or thats the theory anyway.

Can anyone help ?
Here is my code:-

var ZIndex=1;
var iw = new google.maps.InfoWindow({ content:contentString });
google.maps.event.addListener(iw, 'click', handleInfoWindowClick(iw) );

function handleInfoWindowClick(infoWindow) {
   return function() {
      infoWindow.setZIndex(ZIndex++);
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:22:45+00:00Added an answer on June 17, 2026 at 12:22 pm

    there is no click-event for an infoWindow, it’s a little bit more difficult.

    1. you’ll need to use an element(not a string) as content for the infowindow, because you need a DOMListener instead a listener for the infowindow-object
    2. when domready-fires, you must apply the click-DOMListener to the anchestor of this content-node that defines the infowindow

    The following code will do this for you, add this to your page:

    google.maps.InfoWindowZ=function(opts){
              var GM = google.maps,
                  GE = GM.event,
                  iw = new GM.InfoWindow(),
                  ce;
    
                 if(!GM.InfoWindowZZ){
                    GM.InfoWindowZZ=Number(GM.Marker.MAX_ZINDEX);
                 }
    
                 GE.addListener(iw,'content_changed',function(){
                   if(typeof this.getContent()=='string'){
                      var n=document.createElement('div');
                          n.innerHTML=this.getContent();
                          this.setContent(n);
                          return;
                   }
                   GE.addListener(this,'domready',
                                   function(){
                                    var _this=this;
                                    _this.setZIndex(++GM.InfoWindowZZ);
                                    if(ce){
                                      GM.event.removeListener(ce);
                                    }
                                    ce=GE.addDomListener(this.getContent().parentNode
                                                      .parentNode.parentNode,'click',
                                                      function(){
                                                      _this.setZIndex(++GM.InfoWindowZZ);
                                    });
                                  })
                 });
    
                 if(opts)iw.setOptions(opts);
                 return iw;
            }
    

    Instead of google.maps.InfoWindow() you must call now google.maps.InfoWindowZ()

    It also returns a genuine InfoWindow, but with the mentioned listener applied to it. It also creates the node from the content when needed.

    Demo: http://jsfiddle.net/doktormolle/tRwnE/


    Updated version for visualRefresh(using mouseover instead of click) http://jsfiddle.net/doktormolle/uuLBb/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have an input field on my website with autocomplete for
I have GoogleMaps-object. Also I have SouthWest and NorthEast point in GLatLng-format. Also I
I am new to the googlemaps API. I have written a small app for
i have google Maps and when the user touch any point in the map
I am developing a web application where i have database backend with geo located
In my application using Google maps APIv3, I am trying to randomly generate some
I am working on a website using Google maps apiv3. I have a button
Using the Google Maps API v3 I've been able to update multiple positions of
Hi all and thanks for the support. I have a website that loads GoogleMaps
I have a google maps api v3, which uses The Di Lab's plugin for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.