Answer the question
In order to leave comments, you need to log in
How to calculate the final screen height on IOS Safari when the screen is rotated?
I do this and get the initial width after rotation, and not the final one. Tried clientHeight, but it's not always correct. Works with setTimeout but how to calculate turn time.
window.addEventListener("orientationchange", () => {
console.log('Смена');
// если сравнивать значение высоты и значение полученные в setTimeout. Они не равны.
console.log(document.documentElement.clientWidth);
console.log(document.documentElement.clientHeight);
// с этим проблем нет
console.log(window.orientation);
console.log(screen.orientation);
setTimeout(()=> {
console.log(document.documentElement.clientWidth);
}, 1000)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question