Open Schmidtze2 opened 5 years ago
Hi,
I think I solved it for myself and maybe it's also a good idea for your code: I changed for example the code in osm-category.tpl at the end to
<div id="map"></div>
{footer_script require='jquery'}
var map;
{literal}function showMap() {{/literal}
{$OSMJS}
{literal}
}
$(document).ready(function() {
showMap();
map.on('moveend', onMapMove);
function onMapMove(e){
getMarkers();
}
function getMarkers(){
var bounds = map.getBounds();
}
});
{/literal}
{/footer_script}
In the file functions_map.php the the "var" in front of "new L.Map()" has to be removed, because this var is now set outside of the function "showMap()"...
I'm just trying to get the map working in a collapsible Bootstrap panel, so it will be initialized only if the panel is shown. The code above is a first step because I can use "showMap()" now :-)
Best regards Friedemann
@Schmidtze2 maybe this is worth submitting a merge request? I'd like for the pages to load faster, as well.
Hello,
first: many many thanks for this plugin!!! :-)
I noticed that for example the picture page sometimes takes about 10 seconds to show up. In my opinion it's the map which takes a long time to render. As I said, sometimes, I think it depends on the current speed of the map server.
My suggestion: Is it maybe possible to do the map initialization in "$(document ).ready()"? Then the page will be shown already, also when the map isn't finished already.
I just enabled the visibility of the map for all users, normally it's disabled for unregistered users. So you can see it here: https://fotos.friedemann.info/picture.php?/36228/category/album-neu-hinzugefuegt
When disabling the map, it's much more faster. I just tried it for myself to change the code, but I didn't find it out by now how to move the map initialization to document.ready() by now.
Best regards Friedemann