Pros
- Free Software
- Community and Documentation
- Browser, DOM and Ajax Support
Classic Board Game with jQuery
In 2013, colleagues agreed a game was hard to build, with few specialized libraries and a lot to wire up by hand. I disagreed. You could build one with almost anything, even something as far from games as jQuery. They called it impossible. So I built it.
jQuery
Memorize

Memorize
01: Board
Compact and rectangular area where the playing cards are grouped.
02: Playing cards
Select playing cards between available ones and, if possible, without repeating.
02: Playing cards
Shuffle the deck to unsort the playing cards.
$.merge(list, list) concatenates the list onto itself: that
single call is what turns cards into pairs. The shuffle is
Fisher-Yates:
walk from the end, swapping each card with a random earlier one, so every
ordering is equally likely.
03: Print elements
03: Print elements
--long is the column count; the JS computes it and sets it on
the board.
03: Print elements
DOM and style manipulation.
The JS sets --long and --short on the board; CSS grid
uses them for the column count: --long in landscape,
--short in portrait.
04: Player interaction
A click selects a card: set its status from hide to
view and push its face into pair. On the second
card, compare.
04: Player interaction
On the second card, compare the pair: a match promotes both to
show; a miss returns them to hide. Then reset
count and pair for the next turn.
Cards match by image source: pair holds two
<img src> values, equal only when it is the same
emoji file.
04: Player interaction
jQuery adds the motion: on reveal the cover slides up, and a missed pair
slides back down after delay(500).
The // ... parts are unchanged from the earlier slides. New here:
slideUp reveals the card, and a missed pair slides back down after
delay(500).