Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been trying to have a tag occur when I hover over each of the markers on this map, describing what Is here and why to visit these places, but I don't know how. Does anybody know how to make this happen?

What I have tried:

This is what I've been working with. Since I don't know hot to make the tags appear, they are not in the code.

HTML
<!DOCTYPE html>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Assignment 10 Part 2

#map {
  height: 100%;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

<div id="map"></div>

function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 3,
    center: {lat: 40.699448, lng: -74.010264, zoom: 11}
  });
  var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  var markers = locations.map(function(location, i) {
    return new google.maps.Marker({
      position: location,
      label: labels[i % labels.length]
    });
  });
  // Add a marker clusterer to manage the markers.
  var markerCluster = new MarkerClusterer(map, markers,
    {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
  }
  var locations = [
    {lat: 40.689290, lng: -74.044490},
    {lat: 40.711475, lng: -74.012650},
    {lat: 40.782832, lng: -73.966986}
  ]
Posted
Updated 4-Mar-18 8:19am
v2

1 solution

Info windows  |  Google Maps JavaScript API  |  Google Developers[^]

See the sample. When creating a new marker, one of the attributes you can set is 'title', which is the standard attribute in HTML for tooltip...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900