Answer the question
In order to leave comments, you need to log in
How to disable scripts connected to the page through @media screen?
Hello everyone, here's the bottom line, there is an adaptive site.
The script is connected in the body
<script type='text/javascript' src='script.js'></script>
@media screen and (max-width: 480px) {}
script is not needed, as it interferes. Answer the question
In order to leave comments, you need to log in
The simplest is to wrap the internals of your script in if ($( document ).width() > 480)
.
But it is more correct, of course, to load it only when it is really needed:
if ($( document ).width() > 480) {
$.getScript( "script.js");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question