Luke
Luke

Reputation: 1850

Jquery Resize: how to check if a screen has been resized at any point

I'm using the jQuery .resize() event listener, and understand how to use it to trigger an action whenever the screen is re-sized. However, I'm wondering if there is a way in jQuery to allow one not just to listen for when a screen is re-sized, but to check whether or not a screen has been re-sized at all over the course of a user's session.

Upvotes: 0

Views: 86

Answers (1)

Sabrina
Sabrina

Reputation: 617

For a simple approach you could log the initial viewport dimensions and compare them later. $(window).width(); and $(window).height(); will give you the dimensions.

Upvotes: 1

Related Questions