hello,
i need you help in my script all my markers are loaded with a popup which give a link to a page: like this (all works fine)
var markers = [{pos: [44.653024, -69.19922], popup: '<a '+am+'page1.htm"><b>page1</b></a>'},
{pos: [39.504041, -105.322267], popup: '<a '+am+'page2.htm"><b>page2</b></a>'},
{pos: [-23.335534, -67.177734], popup: '<a '+am+'page3.htm"><b>page3</b></a>'},
etc...'}];
markers.forEach(function (obj) {var m = L.marker(obj.pos).addTo(map), p = new L.Popup({autoClose:false, closeOnClick:false}).setContent(obj.popup).setLatLng(obj.pos); m.bindPopup(p).openPopup();});
on my site each page correspond to a marker, i would that when a page is loaded the marker which correspondt to the page come on center
i imagine to include in the script something to get the name of the page by example "page1.htm" then an other part which can get 44.653024, -69.19922 then put them at the end of the script inside map.setView(new L.LatLng(lat, lng), 5);
i am not a professional in javascript and i dont know how to do perhaps someone could help me
thanks