Answer the question
In order to leave comments, you need to log in
How to disable the script on the mobile version of the site?
Friends, help disable jq script. You need to make sure that it works only on the desktop, and turns off on the mobile.
The script itself:
jQuery('document').ready(function () {
var $top = $(".menu")
$(window).on("scroll", function () {
if ($(window).scrollTop () <= 650) {
$top.fadeIn();
} else {
$top.fadeOut()
}
});
});
Answer the question
In order to leave comments, you need to log in
for example like this:
jQuery('document').ready(function () {
var $top = $(".menu");
var isMobile = $(window).width() < 1280; // <- true, если ширина экрана меньше 1280
$(window).on("scroll", function () {
if (isMobile) return; // <- Если ширина экрана меньше 1280, то выходим из функции
if ($(window).scrollTop() <= 650) {
...
}
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question