JQuery
JQuery is another powerful Javascript library. Here once again, we're using a ready made Javascript project built from a framework.
This project demonstrates how JQuery can be used to create a sliding puzzle.
Here is what the sliding puzzle looks like.
View Slide Puzzle
Downloads
jquery-latest.pack.js
jquery.puzzle.js
monalisa.jpg
The "puzzle" html file can be viewed and downloaded below.
- <!DOCTYPE html>
- <html>
- <head>
- <title>Sliding Image Puzzles</title>
- <script type="text/javascript" src="js/jquery-latest.pack.js"></script>
- <script type="text/javascript" src="js/jquery.puzzle.js"></script>
- <script type="text/javascript">
- // The puzzle number corresponds to the size of the puzzle pieces
- $(
- function(){
- $( "div.puzzle, p" ).puzzle( 100 );
- }
- );
- </script>
- </head>
- <body>
- <center>
- <h2>
- Sliding Image Puzzles
- </h2>
- <!-- images must be 300 by 300 pixels square -->
- <!-- START COPYING HERE -->
- <div class="puzzle">
- <img src="images/monalisa.jpg" />
- </div>
- <!-- STOP COPYING HERE -->
- </center>
- </body>
- </html>
Make sure the javascript files are placed in a folder called js and the images are placed in a folder called images.
Sample Projects
Students will
- collect images for a small website about an artist or photographer or other cultural form of visual expression (or use images from previous assignment) and implement a lightbox slideshow
- use Photoshop to resize/crop images as needed and create sliding puzzle page