How to detect the state of the screen rotation?

244 views Asked by At

I am writing an implementation of orientationchangeend event.

To detect the end of orientationchange, I am tracking the state of window.innerWidth and window.innerHeight after the orientationchange event has been fired. If these values do to not change for X number of iterations (using setInterval), I fire the orientationchangeend.

Is there another variable I could be tracking instead of window.innerWidth/window.innerHeight that is more definitive? Is the rotation progress exposed anywhere in the API? (e.g. CSS transformation that rotates the screen; assuming there is one).

0

There are 0 answers