Do Something if Screen if Smaller than in jQuery

How to run a jQuery function when screen is smaller than a certain breakpoint using window width.

Last week i wanted to do some jQuery functions when the screen was smaller than a certain size. This script will help you run your functions when reaching a certain break point. 

 

if ($(window).width() < 767) {
   alert('Less than 767');
}
else {
   alert('More than 767');
}

 

StackOverflow Source: https://stackoverflow.com/questions/7715124/do-something-if-screen-width-is-less-than-960-px