Chapter 2. Building a Jigsaw Puzzle Game

Moving forward a bit more, in this chapter, we will see more (and slightly complex) use cases of draggable and droppable components. We will develop a jigsaw puzzle game where we will divide a picture into small pieces of the same size, and the user will have to rearrange these small pieces by dragging and dropping them to form a complete picture.

The UI will have two containers on the page. One container will be used to keep the puzzle pieces, and the other will act as a canvas for arranging these pieces. Initially, users will be displayed a picture along with a Start button. Once the Start button is clicked, the image will be divided into 16 pieces and these pieces will be placed in a separate container. ...

Get Mastering jQuery UI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.