js: initialize nearby items even if map is already loaded (#73790)
gitea-wip/publik-base-theme/pipeline/pr-main This commit looks good Details
gitea/publik-base-theme/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Frédéric Péters 2023-01-24 15:20:08 +01:00
parent 5b2a17a335
commit e79b971089
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@ $(function() {
}
var nearby_list = $('ul.nearby-forms');
if (nearby_list.length) {
$(document).on('wcs:maps-ready', function() {
var prepare = function() {
var $map_widget = $('.qommon-map');
var map = $map_widget[0].leaflet_map;
var geojson_data = [];
@ -97,6 +97,11 @@ $(function() {
});
return false;
});
});
};
if ($('[data-map-ready]').length) {
prepare();
} else {
$(document).on('wcs:maps-ready', prepare);
}
}
})