我正在尝试制作一个基于 javascript 的小游戏。
除了几个问题,它几乎可以正常工作:-
On click of any
TD
, if the image is in thatTD
, cell border color should be green otherwise if you have clicked on wrongTD
, border color turns to red.
This functionality is working only first time you start the game. from next time it is always showing red border color.Till level 8, the changing of border color is visible, but as you increase the level, user cannot experience whether he has hit the correct cell or not. I want something like as soon as you have hit the correct cell, the color change should be visible and stable until image appears into another cell.
代码和建议的任何改进都是值得赞赏的。
最佳答案
第二次开始游戏时,调用startGame()
。
在 startGame()
中,您有一个 $('td').click()
,它会第二次触发,所以每次点击时,它都会实际点击两次(一次 catch ,一次未命中)。
关于javascript - 边框颜色更改仅在第一次起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18270833/