Skip to main content

jQuery Screen Width Condition

Submitted by admin on Thu, 01/06/2022 - 08:32

In this jQuery tutorial we will learn how to set conditions in jQuery to do something when screen width size is less than or more than xx px.

We may need to execute some jQuery codes only for mobile devices or only for big screen devices (laptop / desktop). This is required when we are developing a responsive layout.

Setting screen width condition is very simple in jQuery. Doing media queries in jQuery is as simple as we do in CSS. Use below code if we want to do something when screen width is less than 768px.

Subscribe to jQuery