$(document).ready(function() {
prepareForMobile(); newgame();
})
function prepareForMobile(){
if( documentWidth > 500){
gridContainerWidth = 460;
cellSpace = 20;
cellSideLength = 100;
}
$('#grid-container').css('width', gridContainerWidth );
$('#grid-container').css('height', gridContainerWidth);
$('#grid-container').css('padding', cellSpace);
$('#grid-container').css('border-radius', 0.02*gridContainerWidth);
$('.grid-cell').css('width', cellSideLength);
$('.grid-cell').css('height', cellSideLength);
$('.grid-cell').css('border-radius', 0.02*cellSideLength);}
为什么我这个代码不能实现屏幕自适应,出现下图情况
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...