The condition was written but how to turn off this line with a width of more than 200px

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 

I do not know.

 var width = document.documentElement.clientWidth; if (width > 200) { alert(width); } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <head> <script type="text/javascript" src="/sites/all/themes/landing/script.responsive.js"></script> </head> 

    3 answers 3

    Wrap it in div. Give the diva a class. In the styles in the section via the viewport, if <200 the width of the device screen, list this class as display: none and in the usual section write as display: block! Important

     <div class="ubrat"><script>Тело скрипта</script></div> 

    In CSS

     .ubrat{display:block;} @media only screen and (max-width:210px) { .ubrat{display:none!important;} } 
    • Um .. Scripts are invisible anyway. He does not need this. - Qwertiy
    • Why should I conclude in div if I need to turn off the script loading on those devices on which it is not needed - Evgeni Shevtsov

    Try this

     function dhtmlLoadScript(url) { var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); } var width = document.documentElement.clientWidth; if (width < 200) { dhtmlLoadScript("https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"); } 
    • but how exactly does one delete <script src = " ajax.googleapis.com/ajax/libs/jquery/2.0.0/… > ?? I have several scripts in the heade. - Evgeny Shevtsov
    • where can I substitute his url? - Evgeny Shevtsov
    • do not write it, add code here, if the width is less than 200. - Jean-Claude
    • but I saw everything, thank you, I will try - Evgeny Shevtsov
    • The script works fine. I check no errors in the code - Evgeny Shevtsov

    You can remove it from the page, but since it was loaded into memory, it will remain there and it seems like nothing can be done about it.