javascript - How to zoom on marker click event in Mapbox Leaflet? -


i want zoom on marker when clicked. using mapbox , leaflet.

i tried:

marker.on('click', function(e){     map.setview([e.lat, e.lng], 12); }); 

but gives me kind of error:

typeerror: t null

i tried:

marker.on('click', function(e){     map.fitbounds(marker.getbounds()); }); 

to latitude , longitude of event, must use e.latlng: latlng reference. use this:

marker.on('click', function(e){     map.setview(e.latlng, 13); }); 

Comments

Popular posts from this blog

r - Trouble relying on third party package imports in my package -

Payment information shows nothing in one page checkout page magento -