2048界面不能屏幕自适应

$(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);

}

为什么我这个代码不能实现屏幕自适应,出现下图情况

clipboard.png

阅读 2.2k
1 个回答

html代码也贴出来看看?用控制台看看,有没有什么其他的东西。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题