跌丝哇
你在newgame()里面没有电泳 updateboardview()
慕哥1387267
没有把函数绑定到按钮上吧
慕哥1387267
应该是没有给父元素设置relative,以及给这个元素设置position:absolute?
别揪我小马尾
showanimation里面的left: getPosLeft(i, j)应当没有逗号
别揪我小马尾
roylawxi
你在浏览器里按F12,然后看Consloe的报错提示你就知道了
蟹堡王的蜗牛乙
不好意思,,,,,,我在showanimation2048.js上的var numberCell= $('#number-cell'+i+"-"+j);中number-cell后面没有加-,所以没有显示
Chitose
line-height = height = 100px,就自动居中了
慕村4438141
用电脑网页端进直接在视频下方右端
爱编程的男孩
忆_卿
云在258
活该哈哈哈哈
NadiaSmile
根据我的经验,一般这种问题都是很简单的一些错误!!!两个问题
1.showNumberWithAnimation函数里取numberCell的时候的$("#number-cell-")要加#号的亲
2.还是这个函数里面的改变背景颜色的css("",getNumberBackgroundColor());后面那个不用加引号啊亲。
PS:还有一个问题,虽然对你现在这个问题没影响,不过也是错误的。在updateBoardViwe()函数里面的那个else判断里最后没有加theNumberCell.text(board[i][j]);没有内容样式改了也是白改呀,亲。
不过居然有人同时在学这个课程。。。。看评论都是2015年的,挫败感好强
朱沐木
奇怪!!我的代码都是从格子中间开始显示的,因为每个格子position是absolute的啊
MARSGGBO
你查看到的应该是初始化的数组值吧
hxy885043
当代码执行了return,程序就会跳出这个方法,那下面的代码就不会再执行了
joykit
我知道题主哪错了,是那个nospace函数,return true的位置放错了,直接放在nospace的最外层,就好了
qq_熊永远十八岁_0
那你得给出你的完整代码。别人才能看出问题。
风吹起了夏
BiLaL
哭半天不知道谁死了
静静晶晶
同状况,发现数字在很下面。检查了半天,原来是line-height没加px。
紫境之巅
xzx
xzx
function updateBoardView(){
$(".num-cell").remove();
for(var i =0;i < 4;i++){
for(var j = 0;j < 4;j++){
$("#grid-container").append('<div class="number-cell" id="number-cell-'+i+'-'+j+'"></div>');
var theNumberCell = $('number-cell-'+i+'-'+j);
if (board[i][j] == 0){
theNumberCell.css("width","0px");
theNumberCell.css("height","0px");
theNumberCell.css("top",getPosTop(i,j)+50);
theNumberCell.css("left",getPosLeft(i,j)+50);
}else{
theNumberCell.css("width","100px");
theNumberCell.css("height","100px");
theNumberCell.css("top",getPosTop(i,j));
theNumberCell.css("left",getPosLeft(i,j));
theNumberCell.css("background-color",getNumberBackgroundColor( board[i],[j] ));
theNumberCell.css("color",getNumberColor( board[i],[j] ));
theNumberCell.text(board[i],[j]);
}
}
}
}
ijobs
我又叫大麦了
雪落百合
雪落百合
雪落百合
TortoiseChen