You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
i am trying to implement multiple marker with infowindows when marker id clicked but somwhow value of infowindow is undefined. i am new to jquery but all other issues and code examples on internet seems similar to this.
I am really confused if it is happening to me only or there is some change in usage of infowindow functionality.
It is not a jQuery problem. Just leave the "content" property of infowindow empty, and add "ctext" or similar property to each marker and use it in your marker.forEach loop. It will dynamically set the content of infowindow.
$('#cmap')
.gmap3({
center: [51.08314890, 17.04792140],
zoom: 11
})
.marker([
//foreach loop or sth similar to generate your markers
{ position: [/*item latitude*/, /*item longitude*/],
icon: "img/pin.png",
ctext: "item text to display on infowindow" },
// end foreach loop
])
.infowindow({
content: ''
})
.then(function (infowindow) {
var map = this.get(0);
var marker = this.get(1);
marker.forEach(function(item,i){
item.addListener('click', function() {
infowindow.setContent(item.ctext);
infowindow.open(map, item);
});
})
});
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
i am trying to implement multiple marker with infowindows when marker id clicked but somwhow value of
infowindow
is undefined. i am new to jquery but all other issues and code examples on internet seems similar to this.I am really confused if it is happening to me only or there is some change in usage of infowindow functionality.
The text was updated successfully, but these errors were encountered: