V
V
Vladislav Boychenko2016-01-24 05:26:20
JavaScript
Vladislav Boychenko, 2016-01-24 05:26:20

How to disable specific js file based on screen resolution?

Good day.
I'm using the Bootstrap grid, everything else from it is disabled. Added a script for vertical full-screen scrolling of content sections. Sections have 100% width and height, overflow property is hidden. Everything looks decent on a PC/laptop, the content fits into the blocks, but if you decrease the window size, only part of the content is visible, the rest is hidden due to overflow: hidden. Therefore, for small screen resolutions, I want to disable this script so that there is a standard scrolling, and not in sections.
In Google I found ways through if (with such a screen) {do this} else {do ​​that}, but they are few, that is, they do not work at all.
Therefore, I turn here: how to disable a JS file depending on the size of the window? So to speak, media queries for JS, or something.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2016-01-24
@vladislav_boychenko

When loading the page, you can choose which scripts to connect as follows:

<script>
If (document.body.clientWidth>768){
  document.write('<script src=...>')
}
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question