Решение на js
/*Viewport Height Correction
https://github.com/Faisal-Manzer/postcss-viewport-height-correction
.foo {
height: 100vh;
height: calc(var(--vh, 1vh) * 100); //
}
*/
var customViewportCorrectionVariable = 'vh';
function setViewportProperty(doc) {
var prevClientHeight;
var customVar = '--' + ( customViewportCorrectionVariable || 'vh' );
function handleResize() {
var clientHeight = doc.clientHeight;
if (clientHeight === prevClientHeight) return;
requestAnimationFrame(function updateViewportHeight(){
doc.style.setProperty(customVar, (clientHeight * 0.01) + 'px');
prevClientHeight = clientHeight;
});
}
handleResize();
return handleResize;
}
window.addEventListener('resize', setViewportProperty(document.documentElement));
/*/Viewport Height Correction*/