$(document).ready(function () { var rollWidth=$(window)[0].innerWidth-$(window).width(); $("#background").css("width",$(window)[0].screen.width-rollWidth); });
动态获取屏幕宽度,并减去了浏览器左边滚动条的宽度
最新推荐文章于 2024-05-29 16:27:42 发布
$(document).ready(function () { var rollWidth=$(window)[0].innerWidth-$(window).width(); $("#background").css("width",$(window)[0].screen.width-rollWidth); });