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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:17:11+00:00 2026-06-09T16:17:11+00:00

I do not know what to do… I just want to close all opened

  • 0

I do not know what to do… I just want to close all opened infoBubbles if I’m going to open a new one. I am using the following code. Ideas? I tried a lot and googled a lot but it shouldn’t be so complicated, should it? I thought to create an array and save id for the open one, but I think that there must be another, quite easier way to fix this.

$(document).ready(function(){
            createmap();

    function createmap(lat,lng){
        var latlng = new google.maps.LatLng(50, 10);
    var myOptions = {
    zoom: 12,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
    bounds = new google.maps.LatLngBounds();
            createMarker();
    }

    function createMarker(){
            var markers = [];
            var cm = window.cm = new ClusterManager(
                map,
                {
                    objClusterIcon: new google.maps.MarkerImage('images/map/flag_cluster.png', false, false, false, new google.maps.Size(20,20)),
                    objClusterImageSize: new google.maps.Size(20,20)
                }
            );

            var json = [];
            var x1 = -85;
            var x2 = 85;
            var y1 = -180;
            var y2 = 180;
            for (var i=0; i<20; ++i) {
                json.push(
                    '{'+
                        '"longitude":'+(x1+(Math.random()*(x2-x1)))+','+
                        '"latitude":'+(y1+(Math.random()*(y2-y1)))+','+

                        '"title":"test"'+
                    '}'
                );
            }
            json = '['+json.join()+']';
            // eval is ok here.
            eval('json = eval(json);');

            infos = [];
            $.each(json, function(i,item){      
    var contentString = '<div id="content"><a onclick="createdetailpage('+i+');">'+item.title+'<br /></a></div>';

                console.log(item.latitude);
                var myLatlng = new google.maps.LatLng(item.latitude,item.longitude);
            var marker = new google.maps.Marker({
                    position: myLatlng, 
                    //map: map, 
                    flat: true,
                    title:item.title,
                    //animation: google.maps.Animation.DROP,
                    //icon: myIcon
                });  
                var infoBubble = new InfoBubble({               
                    content: '<div class="phoneytext">'+contentString+'</div>'
                });                                

                google.maps.event.addListener(marker, 'click', function() {
                    if (!infoBubble.isOpen()) {
                        infoBubble.open(map, marker);
                    }
                }); 
                cm.addMarker(marker, new google.maps.Size(50, 50));                 
            });
        map.fitBounds(bounds);              
    }
    });
  • 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-09T16:17:12+00:00Added an answer on June 9, 2026 at 4:17 pm

    The simplest approach to only have one infoBubble open is to only have one infoBubble and open it with different contents depending on the marker that is clicked.

    InfoWindow example with custom markers (same concept applies to InfoBubble)

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

Sidebar

Related Questions

I do not know how to ask this question. So I will just give
I do not know why my google markers are not showing. I am using
I do not not know much about Regex, I want to try parsing sting
I know it is not good to just put a try catch with Exception
I do not know what changed in my environment, but all of a sudden
I do not know whether it is possible but i want something like <f:view>
I do not know if that is possible but I want to change/set a
I do not know what is the reason of this but I just installed
I do not know how to classify this question. Vaguely, its about using calculated
I really do not know any PHP but I'd love to do one simple

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.