我正在使用:<meta name="apple-mobile-web-app-capable" content="yes">
并在我的主屏幕上添加一个图标以绕过 iPhone 上的浏览器 Chrome。但是,使用此代码时,我将 div 高度设置为设备高度的 100% 的代码失败了。
$(".swiper-container").css({
"width" : $(window).width(),
"height" : $(window).height()
});
如果我在 Safari 上正常运行该页面,它工作正常,但如果我从保存的主屏幕图标运行则不行。有什么想法吗?
干杯。
更多信息:
www.andrewlarking.co.uk/LBSEvents/lbss.html
最佳答案
尝试使用不带 jQuery 的纯 javascript 执行此操作,将 id=swiper-container 放入您的 div 中并使用此代码:
e = document.getElementById('swiper-container');
e.style.height = window.innerHeight + "px";
e.style.width = window.innerWidth + "px";
关于javascript - 使用主屏幕图标会破坏 iPhone 上的设备高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17425956/