
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
orientationchangeend
Advanced tools
The orientationchangeend event is fired when the orientation of the device has changed and the associated rotation animation has been complete.
orientationchangeendThe orientationchangeend event is fired when the orientation of the device has changed and the associated rotation animation has been complete. orientationchangeend enables you to capture dimensions of the element in the state after the rotation change.
There is no way to capture the end of the orientation change event because handling of the orientation change varies from browser to browser. Drawing a balance between the most reliable and the fastest way to detect the end of orientation change requires racing interval and timeout.
A listener is attached to the orientationchange. Invoking the listener starts an interval. The interval is tracking the state of window.innerWidth and window.innerHeight. The orientationchangeend event is fired when config.noChangeCountToEnd number of consequent iterations do not detect a value mutation or after config.noEndTimeout milliseconds, whichever happens first.
If there is a series of orientationchange events fired one after another, where n event orientationchangeend event has not been fired before the n+2 orientationchange, then orientationchangeend will fire only for the last orientationchange event in the series.
var config = {},
OCE;
// Start tracking the orientation change.
OCE = gajus.orientationchangeend(config);
// Attach event listener to the "orientationchangeend" event.
OCE.on('orientationchangeend', function () {
// The orientation have changed.
});
To make the orientationchangeend event available to the window, re-emit the event using a custom event:
var orientationchangeend;
// Make sure that you are not adding event emitter more than once.
if ('onorientationchangeend' in window) {
window.onorientationchangeend = true;
orientationchangeend = new CustomEvent('orientationchangeend');
OCE.on('orientationchangeend', function () {
window.dispatchEvent(orientationchangeend);
})
}
// Attach a listener to the "orientationchangeend" event.
window.addEventListener('orientationchangeend', function () {
console.log('The orientation of the device is now ' + window.orientation);
});
| Name | Value | Default |
|---|---|---|
noChangeCountToEnd | Number of iterations the subject of interval inspection must not mutate to fire orientationchangeend. | 100 |
noEndTimeout | Number of milliseconds after which fire the orientationchangeend if interval inspection did not do it before. | 1000 |
debug | Enables logging of the events | false |
All of the configuration parameters are optional.
Using Bower:
bower install orientationchangeend
Using NPM:
npm install orientationchangeend
The old-fashioned way, download either of the following files:
FAQs
The orientationchangeend event is fired when the orientation of the device has changed and the associated rotation animation has been complete.
We found that orientationchangeend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.