How To Remove jQuery Script On A Mobile Device Or Specific Screen Width?

This tutorial shows you 2 ways to prevent jQuery from working at a specific screen width. The tutorial is written in response to this question from a member.

Thanks for the tutorial. Do you know how to remove this script on a mobile device or certain media query?

Firstly, lets take a look at the jQuery script in question and test the modified version which conditionally disables the header scrink script from running when the screen size is reduced to any width you include in the code. In this case its 1023px.

Here’s the 2 solutions you can use in any jQuery script or in this case, if you’re wanting to disable the jQuery for the header shrink in the Centric Pro child theme, you’ll find the fully modified jQuery below.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.