gmap3 icon indicating copy to clipboard operation
gmap3 copied to clipboard

Can't remove a single marker

Open adam-jones-net opened this issue 5 years ago • 0 comments

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();

adam-jones-net avatar Feb 23 '20 22:02 adam-jones-net