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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:50:36+00:00 2026-05-31T17:50:36+00:00

I added markers onto my map via this function. markers : an array of

  • 0

I added markers onto my map via this function.

markers: an array of Marker objects
location: a LatLng object
myMarkerTitle: the desired title for my marker

// adds new markers to the map.
function addAMarker(location, myMarkerTitle) {
    newMarker = new google.maps.Marker({
            position: location,
            map: map
    });
    newMarker.setTitle(myMarkerTitle);
    markers.push(newMarker);
}

It adds markers on the map, but the titles I assigned to the markers do not show. Why?

In the end, I want a map with markers scattered about with titles above them. When a client hovers over and clicks on a marker, more details also surface. Thank you.

  • 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-05-31T17:50:37+00:00Added an answer on May 31, 2026 at 5:50 pm

    From what I understood, you want a tooltip visible at all times. There’s the InfoBox Utility library that can create something like that. It’s very flexible, which also means there are a lot of options to set. An annoyance, for example, is if the text gets too long it flows outside the box (so the width would need to be set dynamically).

    Doc: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html
    Download: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/

    See the screenshot, if it’s what you want, download infobox_packed.js and try the code below.

    InfoBox example

    <!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <style type="text/css">
          html, body, #map_canvas { margin: 0; padding: 0; height: 100% }
        </style>
        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript" src="infobox_packed.js"></script>
        <script type="text/javascript">
          var map;
          var mapOptions = {
            center: new google.maps.LatLng(0.0, 0.0),
            zoom: 2,
            mapTypeId: google.maps.MapTypeId.ROADMAP
          };
          var count = 0;
    
          function initialize() {
            map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
            google.maps.event.addListener(map, 'click', function (event) {
              addMarker(event.latLng, "index #" + Math.pow(100, count));
              count += 1;
            });
          }
    
          function addMarker(pos, content) {
            var marker = new google.maps.Marker({
              map: map,
              position: pos
            });
            marker.setTitle(content);
    
            var labelText = content;
    
            var myOptions = {
              content: labelText
               ,boxStyle: {
                  border: "1px solid black"
                 ,background: "white"
                 ,textAlign: "center"
                 ,fontSize: "8pt"
                 ,width: "86px"  // has to be set manually
                 ,opacity: 1.0
                }
               ,disableAutoPan: true
               ,pixelOffset: new google.maps.Size(-43, -50) // set manually
               ,position: marker.getPosition()
               ,closeBoxURL: ""
               ,pane: "floatPane"
               ,enableEventPropagation: true
            };
    
            var ibLabel = new InfoBox(myOptions);
            ibLabel.open(map);
          }
    
          google.maps.event.addDomListener(window, 'load', initialize);
        </script>
      </head>
      <body>
        <div id="map_canvas"></div>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I added a google map with two markers (i am just testing), the code
The question is pretty self-explanatory. When a marker is added to a google map,
I'm wondering if there is a way to access the Markers that were added
I created a marker interface: public interface ISupportAJAXPostsBacks{} I added it to my Page..
ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen
I'm working on an application that generates a large number of Google Map markers
I have a Google map running on the v3 API, I added some custom
I have an application that uses the mapview-overlay-manager code to draw map markers on
I'm developing a Google Map API v2 app, where markers are loaded from a
I am trying to add markers to a google map created after an ajax

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.