A modern, fully accessible memory card game built with vanilla JavaScript, HTML5, and CSS3. Match pairs of cards while tracking your moves and time!
- Three Difficulty Levels: Easy (4×4), Medium (6×6), Hard (8×8)
- Customizable Themes: 4 visual themes including tropical images from Pexels
- Statistics Tracking: Moves, timer (MM:SS), and pairs matched
- Sound Effects: Card flip, match, mismatch, and victory sounds with toggle
- Full Accessibility: WCAG 2.1 compliant with screen reader support
- Keyboard Navigation: Arrow keys to navigate, Enter/Space to flip cards
- Visual Effects: 3D card flip animations with focus indicators
- Responsive Design: Mobile-friendly and touch-enabled
- Game Icons (default): Classic emoji icons
- Tropical Paradise: Royalty-free tropical images 🌴🥥🍍
- Beach Vibes: Ocean-themed emoji items 🐚🐠🏄
- Sunset Dreams: Warm sunset emoji elements 🌻🦋💎
- WCAG 2.1 Level AA Compliant
- Screen Reader Support: Full ARIA labels and live region announcements
- Keyboard Navigation:
- Tab through controls and cards
- Arrow keys (↑↓←→) to navigate grid
- Enter/Space to flip cards
- Focus Management: High-contrast yellow outline on focused elements
- Semantic HTML: Proper heading hierarchy, landmarks, and roles
- Skip Link: Jump directly to game board
- Select difficulty level (Easy, Medium, or Hard)
- Choose a theme from the dropdown
- Navigate cards using mouse clicks, Tab key, or arrow keys (↑↓←→)
- Flip cards by clicking or pressing Enter/Space when focused
- Match all pairs to win and see your final stats!
All code examples reference script.js.
- Refresh keeps the same game state (cards, moves, timer, difficulty, theme).
- Each tab has its own unique game.
- Total moves count is shared across tabs.
- Reset Moves Total.
Pure function using flatMap() that creates card data without mutating external state.
Clones single template element to dynamically generate all game cards using cloneNode(), appendChild(), and querySelector().
Card click handler using addEventListener() and event delegation pattern.
Arrow functions, const/let, template literals, destructuring, and spread operator throughout.
MemoryGame-JS/
├── index.html # Main HTML with ARIA attributes
├── style.css # Styling and animations
├── script.js # Game logic with accessibility
├── download_images.py # Pexels API image downloader
└── assets/
├── images/tropical/ # 32 royalty-free tropical images
└── sound/ # Sound effects (MP3 files)
HTML5, CSS3 (Flexbox/Grid/Animations), JavaScript ES6+, Web Audio API, ARIA/WCAG 2.1
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Requires ES6+ support
Real-time timer in MM:SS format tracking game duration from first card flip.
Three difficulty options changing grid size and number of card pairs.
Four sound types (flip, match, mismatch, victory) with toggle control and localStorage persistence.
Four themes with unique symbols and color schemes. Theme selection persists across sessions via localStorage.
WCAG 2.1 Level AA compliance with screen reader support, keyboard navigation (arrow keys + Enter/Space), ARIA labels, live regions, and semantic HTML structure.
Enjoy the game! 🎉