Jquery screen width condition will be executed while loading the document. Jquery on window resize play a nice role for developers to help with jquery media queries.

Solution to Jquery Screen Width

The above code will help you to allocate the width of the screen as the page start loading.

The first line is the condition to check whether the window’s width is smaller than 960, if that is true it will alert the “less than 960” text.

You May Want Jquery on window resize to play around

Here is another solution to jquery screen width but this time screen width resize.

$(window).resize() function is playing role here and it will watch for the resizing of windows and will act according.

[[ Also check How to Change Image Source Jquery ]]

Do you still need something very simple?

Also, give try to this one as well

You can also target a specific Id, Class or Div to put condition on your query. replace the ‘body’ with your tag or attribute

If Window Width Jquery – Last Example

You can play with If and else as you want but you can use if window width jquery to help you out in this case.

Wrapping Up the Jquery on Window Resize

Jquery basically help you in doing more with writing less code. The above functions will help you to get the value of screen width. If there is still something confusing please put your query in the comment section.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!