Initialize only visible maps when page is loaded

Its known that initializing a map when it is inside a hidden element
wont work when hidden element is shown, so its makes sense to
avoid initialization of hidden maps.

When a map lives within a hidden layer we need to initialize the
map after the event of showing that hidden layer, in our case when
admin settings tab is shown.
This commit is contained in:
Senén Rodero Rodríguez
2020-07-29 14:44:05 +02:00
parent 99f8bb4491
commit fde6fb4d97
2 changed files with 25 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
"use strict";
App.Map = {
initialize: function() {
$("*[data-map]").each(function() {
$("*[data-map]:visible").each(function() {
App.Map.initializeMap(this);
});
$(".js-toggle-map").on({