I have a problem when I try make a zoom on marker, I got a error:
Uncaught TypeError: e.target.getBounds is not a function
var rotas = L.geoJSON(paradas, {
onEachFeature: onEachFeature
}).addTo(map);
function onEachFeature(feature, layer){
layer.on('click', function(e){
$('.orange').html(feature.properties.nome);
$('.city').html(feature.properties.imagem);
$('.event').html(feature.properties.descricao);
console.log(e.target);
zoomToFeature(e)
});
}
function zoomToFeature(e) {
console.log("pass here")
map.fitBounds(e.target.getBounds());
}
But when I do console.log it return correctly. What I'm wrong? My source code is here:
http://github.com/eltonsantos/analise_integrada
the map.fitBounds appear is ok, but still dont work :( Someone help me? thanks!