In Leaflet how to use control on an existing div?

المشرف العام

Administrator
طاقم الإدارة
In Leaflet, adding control classes like Zoom In/Zoom Out is possible. But I do not want to add a new div into my html. I want to use an existing div to contain my tools. I am pretty sure that it can be done by using onAdd method;

onAdd: function (map) { container = CALL MY OWN DIV ITEM this._map = map; this._zoomInButton = CALL ITEM NO 1 FROM CONTAINER AND ADD `this_zoomIn` FUNCTION this._zoomOutButton = CALL ITEM NO 2 FROM CONTAINER AND ADD `this_zoomOut` FUNCTION this._updateDisabled(); map.on('zoomend zoomlevelschange', this._updateDisabled, this); return container;},Is this possible? I know that in case of zoom in/zoom out I can simply use map.zoomIn(1) command, but I want to call more sophisticated control structures. This is why I need this.

I also tried converting all the methods in control class to functions in order to call them with jquery but I failed to do so.



أكثر...
 
أعلى