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 8267189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:25:36+00:00 2026-06-08T05:25:36+00:00

I am previously using InfoWindow. It is working and it’s limited to show only

  • 0

I am previously using InfoWindow. It is working and it’s limited to show only one InfoWindow, even if I am clicking many markers.

But when I changed it and replaced it with InfoBubble, it displays multiple bubbles. It does not automatically close the previously opened bubble, instead they are remained open and they seemed to be messing my map up.

I don’t know what to do with this problem. Here’s my code.

        downloadUrl("outputXML.php", function(data)
        {
            var xml = data.responseXML;
            var markers = xml.documentElement.getElementsByTagName("marker");
            for (var i = 0; i < markers.length; i++)
            {
                var name = markers[i].getAttribute("name");
                var address = markers[i].getAttribute("address");
                var type = markers[i].getAttribute("type");
                var point = new google.maps.LatLng(
                        parseFloat(markers[i].getAttribute("lat")),
                        parseFloat(markers[i].getAttribute("lng")));
                var html = "<div class='phoneytext'> <b>" + name + "</b> <br/>" + address + "</div>";
                var icon = customIcons[type] || {};
                var marker = new google.maps.Marker
                ({
                    map: map,
                    position: point,
                    icon: icon.icon,
                    title:name
                });

                //Initiate an infoBubble - shows when a marker is tapped/clicked
                infoBubble = new InfoBubble
                ({
                  map: map,
                  shadowStyle: 1,
                  padding: 0,
                  backgroundColor: 'rgb(57,57,57)',
                  borderRadius: 4,
                  arrowSize: 10,
                  borderWidth: 1,
                  borderColor: '#2c2c2c',
                  disableAutoPan: true,
                  arrowPosition: 30,
                  backgroundClassName: 'phoney',
                  arrowStyle: 2
                });                 
                bindInfoBubble(marker, map, infoBubble, html);

            }
       });               

        function bindInfoBubble(marker, map, infoBubble, html)
        {
            google.maps.event.addListener(marker, 'click', function()
            {
                infoBubble.setContent(html);
                infoBubble.open(map, marker);
            });
        }
  • 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-08T05:25:38+00:00Added an answer on June 8, 2026 at 5:25 am

    You could implement Singleton concept:

        downloadUrl("outputXML.php", function(data)
        {
            var xml = data.responseXML;
            var markers = xml.documentElement.getElementsByTagName("marker");
            for (var i = 0; i < markers.length; i++)
            {
                var name = markers[i].getAttribute("name");
                var address = markers[i].getAttribute("address");
                var type = markers[i].getAttribute("type");
                var point = new google.maps.LatLng(
                        parseFloat(markers[i].getAttribute("lat")),
                        parseFloat(markers[i].getAttribute("lng")));
                var html = "<div class='phoneytext'> <b>" + name + "</b> <br/>" + address + "</div>";
                var icon = customIcons[type] || {};
                var marker = new google.maps.Marker
                ({
                    map: map,
                    position: point,
                    icon: icon.icon,
                    title:name
                });
    
                bindInfoBubble(marker, map, html);
    
            }
        });  
    
        var InfoBubbleClass = (function(){
            var instance = null;
            return {
               getInstance:function(){
                   if(instance===null){
                       instance = new InfoBubble
                        ({
                           map: map,
                           shadowStyle: 1,
                           padding: 0,
                           backgroundColor: 'rgb(57,57,57)',
                           borderRadius: 4,
                           arrowSize: 10,
                           borderWidth: 1,
                           borderColor: '#2c2c2c',
                           disableAutoPan: true,
                           arrowPosition: 30,
                           backgroundClassName: 'phoney',
                           arrowStyle: 2
                        });                 
                   }
                   return instance;
               }
            };
        })();             
    
        function bindInfoBubble(marker, map, html)
        {
            google.maps.event.addListener(marker, 'click', function()
            {
                InfoBubbleClass.getInstance().setContent(html);
                InfoBubbleClass.getInstance().open(map, marker);
            });
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on some code that previously was using a cfquery, and is
I was previously using initWithContentsOfURL to download a plist into an NSDictionary, but this
i was previously using the basic filter where filters would show up in the
I was previously using the jQuery autosave plugin but have recently removed it. Some
I'm brand new to Capistrano, working with an existing server that was previously using
I'm looking to implement a REST client in PHP, and have previously been using
previously i was using picture box and its built in utilities to draw some
I have deployed a PHP application on my tomcat server(Tomcat 6.0).Previously I was using
I'm developing a graph control in WPF. I have previously developed it using GDI
Previously when I browsed source code files using Xcode's file browser (located on left

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.