Reputation: 1787
I am initially pushing MapBox Marker objects to an array via:
var el = document.createElement('div' + index);
el.className = 'marker';
deviceMarkers.push(new mapboxgl.Marker(el, { offset: [-50 / 2, -50 / 2] }).setLngLat([device.lat, device.lon]).addTo(map));
Elsewhere in the code, I extract the marker via:
var deviceMarker = deviceMarkers[index];
I would like to be able to get 'el' from deviceMarker object, in order to alter the icon size, orientation etc. dynamically. How can I extract 'el' as the original div?
Upvotes: 2
Views: 564
Reputation: 1602
You can use deviceMarker.getElement()
– this function is currently undocumented but public. I will work on getting it added to the documentation.
Upvotes: 4