Answer the question
In order to leave comments, you need to log in
How to hide the map?
Uses Smarty templating engine,
There is a block
<div class="show_map">{include file='map.tpl'}</div>
if (document.body.clientWidth >640) {
Answer the question
In order to leave comments, you need to log in
Through CSS.
@media only screen and (max-width: 640px) {
.show_map {
display: none;
}
}
We wrap the map in an iframe and load it only on wide screens, or if the browser is stretched to a sufficient width. When narrowing the screen, we simply make the map display:none;
These manipulations are quite easy to implement in js.
I would personally use @media screen
, if using *js, then you need the , object property window
, window.innerWidth
which is responsible for the width of the browser window, not the page element.
document.addEventListener('DOMContentLoaded', function(event) {
var elem = null;
if (window.matchMedia("(min-width: 640px)").matches) {
elem = document.querySelector('div.show_map');
elem.parentNode.removeChild(elem);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question