Update external-map.js

Handle situations when main window loose focus - e.g. by selecting of differen browser tab.
This commit is contained in:
andrewcoder002
2021-10-20 09:29:01 +02:00
committed by Maximilian Krög
parent 7bed63bf3f
commit f74cd62827

View File

@@ -71,5 +71,19 @@ button.addEventListener('click', function () {
// Close window in case user does a page reload // Close window in case user does a page reload
closeMapWindow(); closeMapWindow();
}); });
window.addEventListener('blur', function (evt) {
externalMapTarget.style.opacity=0.3;
});
window.addEventListener('focus', function (evt) {
externalMapTarget.style.opacity=1.0;
});
mapWindow.addEventListener('focus', function (evt) {
if (!window.document.hidden){
externalMapTarget.style.opacity=1.0;
}
});
}); });
}); });