On centre la carte sur l'élément cliqué
This commit is contained in:
parent
533d52a24e
commit
5797dc98bb
@ -64,7 +64,10 @@
|
|||||||
{% for place in object_list %}
|
{% for place in object_list %}
|
||||||
markerArray.push(L.marker([{{ place.location }}]).bindPopup('<a href="{% url 'view_place' place.pk %}">{{ place.name }}</a><br />{% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}'));
|
markerArray.push(L.marker([{{ place.location }}]).bindPopup('<a href="{% url 'view_place' place.pk %}">{{ place.name }}</a><br />{% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}'));
|
||||||
window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
|
window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
|
||||||
window.jQuery('a#open-map-{{ place.id }}').click(function(){ window.mMapping[{{ place.id }}].openPopup();});
|
window.jQuery('a#open-map-{{ place.id }}').click(function(){
|
||||||
|
window.mMapping[{{ place.id }}].openPopup();
|
||||||
|
map.panTo(window.mMapping[{{ place.id }}].getLatLng());
|
||||||
|
});
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
var group = L.featureGroup(window.markerArray).addTo(map);
|
var group = L.featureGroup(window.markerArray).addTo(map);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user