我想创建一个 HTML/CSS/Javascript 页面,可以在手机上全屏显示图片(广告)。智能手机+平板电脑。广告拉伸(stretch)到最大宽度和高度并且没有滚动条。
我尝试了两种不同的方式:
var screenWidth = $(window).width();
var screenHeight = $(window).height();
$('body, .ads-picture').css('width', screenWidth+'px');
$('body, .ads-picture').css('height', screenHeight+'px');
并以其他方式对每个设备进行媒体查询。
但它在任何情况下都不起作用。在 iPhone 5 中图片不是全屏(我需要滚动),在 iPad mini 中也是。
你能帮帮我吗?谢谢!!!
最佳答案
添加以下标签并放置 width: 100% im the images
<meta name="viewport" content="width=device-width, user-scalable=no">
获取更多信息 here
关于javascript - 无滚动条的移动设备全屏广告图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20438418/