leaflet get closest marker with marker array code example
Example: leaflet find nearest marker
Leaflet.GeometryUtil is the best solution I found for that (https://github.com/makinacorpus/Leaflet.GeometryUtil). Use L.GeometryUtil.closestLayer.
It's more practical to use than leaflet-knn because you can send an array of layers (markers for examples), instead of only a geojson layer. But more importantly, it seems faster (about 90% faster with a set of 500+ markers, cold start, on Chrome 36, although on FF31 it's comparable)