Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Can't remove a single marker #153

Open
adam-jones-net opened this issue Feb 23, 2020 · 0 comments
Open

Can't remove a single marker #153

adam-jones-net opened this issue Feb 23, 2020 · 0 comments

Comments

@adam-jones-net
Copy link

adam-jones-net commented Feb 23, 2020

I have setup some maps with popup info windows and that works fine. However now that I need to interact with existing markers I am having trouble. I've seen very brief explanations of how to use setMap(null) but they haven't helped me.

Can someone clarify with a fuller example? My setup code is as follows...

var infoWindows = [];
var locations=[
	{id:'marker1', position:[51.528308,-0.3817765],content:'test content',icon:'assets/mappointer.png'}
]
var map=$('#mapDiv').gmap3({
	mapTypeId: "teststyle",
	scrollwheel: true
})
.marker(locations)
.infowindow(locations)
.then(function (infowindow) {
	// handle click events for each marker
	var map = this.get(0);
	var marker = this.get(1);
	marker.forEach(function(item,i){
		item.addListener('click', function() {
			infowindow[i].open(map, item);
			infoWindows.push(infowindow[i]);
		});
	})
})
.styledmaptype("teststyle",mapStyle)
.fit();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant