Answer the question
In order to leave comments, you need to log in
How to enable/disable the required javascript code?
Good time of the day.
Who will explain how to use different scripts when resizing screens.
For example, when loading, we check the screen size and use the necessary code, but when we change the size, this code must either be disabled or a new one must be used.
On the example of sticky
plugin
For desktop and for tablet, it should work with different parameters.
I read this post, but apparently, it was never decided.
Thank you!
Answer the question
In order to leave comments, you need to log in
Hello, you can use the quick way - using the jQuery plugin https://github.com/matthewhudson/device.js
1) Determine the type of device
2) Depending on the device, assign the necessary parameters
You can also use a small code
<script>
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
// код для мобильных устройств
} else {
// код для обычных устройств
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question