Skip to content

Maps: InfoWindows not appearing #657

@gigo6000

Description

@gigo6000

Environment details

  1. Api Maps
  2. Ubuntu/React
  3. MarkerWithLabel Version ^2.0.14

Steps to reproduce

  1. Go to the basic example: https://googlemaps.github.io/js-markerwithlabel/examples/basic.html
  2. Click on any marker
  3. No InfoWindow shows up

Code example

function initMap() {
        var latLng = new google.maps.LatLng(49.47805, -123.84716);
        var homeLatLng = new google.maps.LatLng(49.47805, -123.84716);

        var map = new google.maps.Map(document.getElementById("map_canvas"), {
          zoom: 12,
          center: latLng,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
        });

        var marker1 = new markerWithLabel.MarkerWithLabel({
          position: homeLatLng,
          draggable: false,
          clickable: false,
          map: map,
          labelContent: "$425K",
          labelAnchor: new google.maps.Point(-21, 3),
          labelClass: "labels", // the CSS class for the label
          labelStyle: { opacity: 0.75 },
        });

        var marker2 = new markerWithLabel.MarkerWithLabel({
          position: new google.maps.LatLng(49.475, -123.84),
          draggable: true,
          map: map,
          labelContent: "$395K",
          labelAnchor: new google.maps.Point(-21, 3),
          labelClass: "labels", // the CSS class for the label
          labelStyle: { opacity: 1.0 },
        });

        var iw1 = new google.maps.InfoWindow({
          content: "Home For Sale",
        });
        var iw2 = new google.maps.InfoWindow({
          content: "Another Home For Sale",
        });
        google.maps.event.addListener(marker1, "click", function (e) {
          iw1.open(map, this);
        });
        google.maps.event.addListener(marker2, "click", function (e) {
          iw2.open(map, this);
        });
      }

Metadata

Metadata

Assignees

Labels

triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions