|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | +<title>My Game Collection</title> |
| 7 | +<style> |
| 8 | + body { |
| 9 | + font-family: Arial, sans-serif; |
| 10 | + background: #111; |
| 11 | + color: #fff; |
| 12 | + margin: 0; |
| 13 | + padding: 0; |
| 14 | + text-align: center; |
| 15 | + } |
| 16 | + h1 { |
| 17 | + margin-top: 20px; |
| 18 | + } |
| 19 | + .game-list { |
| 20 | + display: flex; |
| 21 | + flex-wrap: wrap; |
| 22 | + justify-content: center; |
| 23 | + margin-top: 20px; |
| 24 | + gap: 15px; |
| 25 | + } |
| 26 | + .game-card { |
| 27 | + background: #222; |
| 28 | + padding: 15px; |
| 29 | + border-radius: 8px; |
| 30 | + width: 200px; |
| 31 | + cursor: pointer; |
| 32 | + transition: 0.3s; |
| 33 | + } |
| 34 | + .game-card:hover { |
| 35 | + background: #444; |
| 36 | + } |
| 37 | + iframe { |
| 38 | + width: 100%; |
| 39 | + height: 80vh; |
| 40 | + border: none; |
| 41 | + margin-top: 20px; |
| 42 | + } |
| 43 | + button { |
| 44 | + background: #ff5722; |
| 45 | + border: none; |
| 46 | + padding: 10px 20px; |
| 47 | + color: white; |
| 48 | + cursor: pointer; |
| 49 | + margin-top: 10px; |
| 50 | + } |
| 51 | +</style> |
| 52 | +</head> |
| 53 | +<body> |
| 54 | + |
| 55 | +<h1>🎮 My Game Collection</h1> |
| 56 | +<div class="game-list"> |
| 57 | + <div class="game-card" onclick="loadGame('snake/index.html')">🐍 Snake Game</div> |
| 58 | + <div class="game-card" onclick="loadGame('tetris/index.html')">🧱 Tetris</div> |
| 59 | + <div class="game-card" onclick="loadGame('flappy-bird/index.html')">🐦 Flappy Bird</div> |
| 60 | + <div class="game-card" onclick="loadGame('tic-tac-toe/index.html')">❌⭕ Tic Tac Toe</div> |
| 61 | +</div> |
| 62 | + |
| 63 | +<div id="gameArea" style="display:none;"> |
| 64 | + <iframe id="gameFrame"></iframe> |
| 65 | + <br> |
| 66 | + <button onclick="closeGame()">⬅ Back to Menu</button> |
| 67 | +</div> |
| 68 | + |
| 69 | +<script> |
| 70 | +function loadGame(path) { |
| 71 | + document.querySelector('.game-list').style.display = 'none'; |
| 72 | + document.getElementById('gameArea').style.display = 'block'; |
| 73 | + document.getElementById('gameFrame').src = path; |
| 74 | +} |
| 75 | +function closeGame() { |
| 76 | + document.querySelector('.game-list').style.display = 'flex'; |
| 77 | + document.getElementById('gameArea').style.display = 'none'; |
| 78 | + document.getElementById('gameFrame').src = ''; |
| 79 | +} |
| 80 | +</script> |
| 81 | + |
| 82 | +</body> |
| 83 | +</html> |
0 commit comments