How to disable Jquery script on mobile devices? Is it possible?

Asked

Viewed 61 times

0

I simply want to disable my Jquery script, not to run on devices smaller than 768px, it is possible?

  • 1

    You can do otherwise, don’t you think? Load jQuery only if the user isn’t accessing the page via a mobile device.

1 answer

0

You can put a condition if the width of the screen is greater than 768, run the script, otherwise nothing will be executed.

if ($(window).width() > 768) {
  //Codigo
}
  • Thanks solved my problem! D

  • But will you use jQuery to do this check? What’s the point? The script will already be loaded.

  • If the answer was helpful don’t forget to rate it to help other users too ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.