How to perform a function at a certain screen width ??

Found on the Internet good code perform the function with different width of the screen:
function windowSize(){
if ($(window).width() <= '767') {
// Your code
} else {
// Your code
}
}
$(window).on('load resize',windowSize);

How to register to run code with 3 conditions: when the width is less than 767, 768 to 991, and more-equal to 992 ???
June 3rd 19 at 19:13
1 answer
June 3rd 19 at 19:15
Solution
function windowResize() {
 var width = $(window).width();
 if (width <= 767) {

 } else if (width >= 768 && width <= 991) {

 } else if (width >= 992) {

}
}

Find more questions by tags JavaScriptjQuery