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

  • Home
  • SEARCH
  • 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 8375429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:10:32+00:00 2026-06-09T15:10:32+00:00

I am working in google maps and successfully implemented the infobox plugin of google

  • 0

I am working in google maps and successfully implemented the infobox plugin of google maps.Now my concern is that how can we know that the infobox for a marker is in open state or not. so that I can toggle it on click of the marker…

var locations = [
        //this is array of arrays
    ];

    var map = new google.maps.Map(document.getElementById('map_canvas'),{
        disableDefaultUI : true,
        zoom : 12,
        center : new google.maps.LatLng(defaultLatitude,defaultLongitude),
        mapTypeId : google.maps.MapTypeId.ROADMAP
    });


    var mapcode,myOptions;

    for (var i = 0,len = locations.length; i < len; i++) {
        var marker = add_marker(locations[i][1],locations[i][2],locations[i][3],'this is title',locations[i][0]);
        allMarkers.push(marker);
        marker.setMap(map);
    };

    function add_marker(lat,lng,icn,title,box_html) {

        var marker = new google.maps.Marker({
            animation : google.maps.Animation.DROP,
            position : new google.maps.LatLng(lat,lng),
            map : map,
            icon : icn
        }); 

        mapcode = '<this is the code of infobox to show>';

        myOptions = {
             //options of the infobox...bla bla
        };

        var ib = new InfoBox(myOptions);

        google.maps.event.addListener(marker, 'click', function() {
            ib.open(map, marker);
        });   
        return marker;
    }

I am new in google maps so may be I am missing some very small stuff…thanks in advance….
Ankur

  • 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-09T15:10:34+00:00Added an answer on June 9, 2026 at 3:10 pm

    In case you just need one infobox open at any time you could do it like that:

        var ib = new InfoBox();
        ib.isOpen = false;
        function add_marker(lat,lng,icn,title,box_html) {
    
        var marker = new google.maps.Marker({
            animation : google.maps.Animation.DROP,
            position : new google.maps.LatLng(lat,lng),
            map : map,
            icon : icn
        }); 
    
        mapcode = '<this is the code of infobox to show>';
    
        myOptions = {
             //options of the infobox...bla bla
        };
        marker.ibOptions = myOptions;
    
        google.maps.event.addListener(marker, 'click', function() {
            ib.setOptions(marker.ibOptions);
            ib.open(map, marker);
            ib.isOpen = true;
        });   
        return marker;
    }
    

    If you do it like that you need to reset flag every time you call ib.close() with ib.isOpen = false; (you didn’t specify in what situations do you close the box)

    In case you need multiple boxes to be opened:

    function add_marker(lat,lng,icn,title,box_html) {
    
        var marker = new google.maps.Marker({
            animation : google.maps.Animation.DROP,
            position : new google.maps.LatLng(lat,lng),
            map : map,
            icon : icn
        }); 
    
        mapcode = '<this is the code of infobox to show>';
    
        myOptions = {
             //options of the infobox...bla bla
        };
    
        var ib = new InfoBox(myOptions);
        ib.isOpen = false;
        marker.ib = ib;
    
        google.maps.event.addListener(marker, 'click', function() {
            marker.ib.open(map, marker);
            marker.ib.isOpen = true;
        });   
        return marker;
    }
    

    And again if you ever call allMarkers[…].ib.close() you will need to reset the flag with allMarkers[…].ib.isOpen = false;

    I hope this helps.

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

Sidebar

Related Questions

I have jQuery mobile working with google maps so that I can display one,
I'm working with google maps api and I want the label of a marker
I've been working for a few weeks now with the Google Maps API v3,
Greetings, Until now I have mostly been working with google maps v2. I am
Can anyone recomend a good javascript lib for working with Google Maps or Live
I'm working now on google maps, I'm trying to build something not even half
I'm working on a GWT app that's using Google Maps. I'm trying to add
I need to know that how to add multiple markers on google maps v3
I have this working code : google.maps.event.addListener(marker, 'click', (function (marker, i) { return function
I have been working with google maps and now have a requirement to make

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.