Plugin Contributor
hupe13
(@hupe13)
Please deactivate Litespeed or exclude the the js files from Leaflet Map and Extensions for Leaflet Map from caching.
Hello @hupe13,
Thank you for your help.
I just deactivated LiteSpeed but it doesn’t seem to be better.
Killian
Plugin Contributor
hupe13
(@hupe13)
Okay, try and error. 😉
Please put the the Javascript code in a html block after the [leaflet-marker] shortcode.
No problem @hupe13 🙂
It is already the case, here is the JS present after the shortcode :
<script>
window.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];
window.WPLeafletMapPlugin.push(function () {
var map = window.WPLeafletMapPlugin.getCurrentMap();
if ( WPLeafletMapPlugin.markers.length > 0 ) {
for (var i = 0; i < WPLeafletMapPlugin.markers.length; i++) {
var a = WPLeafletMapPlugin.markers[i];
a.on("click", function (e) {
if (typeof e.sourceTarget.getPopup() != "undefined") {
a.url = e.sourceTarget.getPopup().getContent();
window.location = (a.url);
}
});
}
}
});
</script>
<script>
window.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];
window.WPLeafletMapPlugin.push(function () {
var map = window.WPLeafletMapPlugin.getCurrentMap();
L.control.locate({
strings: {
title: "Localizarme"
}
}).addTo(map);
});
</script>
Plugin Contributor
hupe13
(@hupe13)
Please put the the Javascript code in a html block after the [leaflet-marker] shortcode.
I cant’t see that in the source of the page.
-
This reply was modified 3 years, 8 months ago by
hupe13.
-
This reply was modified 3 years, 8 months ago by
hupe13.
You are right… I misread your message. Sorry 🙁
I confused [leaflet-map] with [leaflet-marker].
I just put the JS after all the [leaflet-marker] set and it works great!
Thanks a lot for your help @hupe13 🙂