Leaflet How to set center map when click marker
<p>I follow this example <a href="http://jsfiddle.net/abenrob/ZkC5M/" rel="noreferrer">http://jsfiddle.net/abenrob/ZkC5M/</a> , When i click marker I want map pan to marker and set position center screen my code is below but when i click map.setView(new L.LatLng(position), 5);
is not working.</p>

<pre><code> function markerFunction(id){
        for (var i in markers){
            var markerID = markers[i].options.title;
            var position = markers[i].getLatLng();

            if (markerID == id){              
                map.setView(new L.LatLng(position), 5);
                markers[i].openPopup();
            };
        }
    }
</code></pre>

<p>Thank you,</p>