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.