googlemaps / googlemaps/js-markerwithlabel

Maps: InfoWindows not appearing

Open
#657 16 comments 2 reactions 1 assignee Claimed by @wangela View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
77
Forks
20
PR merge metrics
No merged PRs in 30d

Description

#### 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

```js
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);
});
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.