Tag Info

New answers tagged


You need to pass the map as a parameter to your control. Map is undefined on the way you pass it. Change the last line of your code from this map.addControl(new app.Geolocate()); to this map.addControl(new app.Geolocate('',map)); check your fiddle with this tiny change here


Marker's have a property called dragging which is an instance of Draggable. You can use marker.dragging.enable() and marker.dragging.disable() to turn dragging on and off. Here's an example: http://jsbin.com/sowere/edit?html,output


Leaflet.EasyButton is a plugin that creates a control (button), not a marker (which is a type of layer). That is why the map.addLayer (and map.removeLayer) is not working with it. You should use the map.addControl and map.removeControl methods instead. The .addTo shortcut works in all cases because the object (marker or control) knows which map method it ...


If you still have the reference to your marker, simply use marker.options to access the options object assigned to it. In your case: marker.options.draggable.

Top 50 recent answers are included