Javascript 使用Vanilla JS添加内联CSS属性和回退值
我试图解决的问题基本上是Safari iOs和Vh计算的问题 以下是函数:Javascript 使用Vanilla JS添加内联CSS属性和回退值,javascript,mobile-safari,Javascript,Mobile Safari,我试图解决的问题基本上是Safari iOs和Vh计算的问题 以下是函数: function overflowHandler() { const header = document.querySelector('.header-container').getBoundingClientRect().height; const regionTop = document.querySelector('.region-top').getBoundingClientRect().he
function overflowHandler() {
const header = document.querySelector('.header-container').getBoundingClientRect().height;
const regionTop = document.querySelector('.region-top').getBoundingClientRect().height;
const totalHeaderHeight = header + regionTop;
if (window.innerWidth < 1080) {
flyout.style.height = 'calc(100vh - ' + totalHeaderHeight + 'px)';
}
}
将呈现为height:-webkit填充可用代码>
我不知道如何让它工作,或者如何确保在iOS上滚动菜单的整个高度。使用element.setAttribute('style','height:-webkit fill available;')
element.style.cssText = 'height: calc(100vh - ' + totalHeaderHeight + 'px); height: -webkit-fill-available;'