js实现点击翻转记忆游戏代码
代码语言:html
所属分类:游戏
代码描述:js实现点击翻转记忆游戏代码,点击方块翻转,记住图形,然后找到相同的图形的方块配对即可。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css"> <style> *, *::before, *::after { padding: 0; margin: 0; box-sizing: border-box; } body { height: 100vh; display: flex; justify-content: center; align-items: center; flex-direction: column; overflow: hidden; font-family: Arial, Helvetica, sans-serif; } .score { display: flex; justify-content: space-between; width: 100%; max-width: 500px; padding: 20px 10px; } .score > * { border-radius: 5px; padding: 5px; background-color: #222; color: beige; } .game-table { max-width: 500px; display: inline-flex; flex-wrap: wrap; } .game-card { flex: 0 0 23%; aspect-ratio: 1; display: flex; justify-content: center; align-items: center; background: beige; border-radius: 5px; transition: all 0.2s linear; margin: 1%; } .game-card i { font-size: 40px; display: none; } .game-card i + i { display: block; } .game-card.flip { background: #5dc6ff !important; transform: perspective(100px) rotateY(180deg); } .game-card.flip i { display: block; } .game-card.flip i + i { display: none; } .game-card.okay { background: #76db82 !important; } .game-card:hover { background: #d1d1c0; } </style> </head> <body> <div class="score"> <div class="trying">Deneme: <span>0</span></div> <div class="successing">Puan: <span>0</span></div> </div> <div class="game-table"> <div class="game-card"> <i class="fa fa-compass"></i> </div> <div class="game-card"> <i class="fa fa-cloud"></i> </div> <div class="game-card"> <i class="fa fa-play"></i> </div> <div class="game-card"> <i class="fa fa-bolt"></i> </div> <div class="game-card"> <i class="fa fa-stop"></i> </div> <div class="game-card"> <i class="fa fa-bolt"></i> </div> <div class="game-card"> <i class="fa fa-cogs"></i> </div> <div class="game-card"> <i class="fa fa-play"></i> </div> <.........完整代码请登录后点击上方下载按钮下载查看
网友评论0