Exercises
To complete these exercises, you will need the index.html
file for this chapter, as well as the finished JavaScript code as found in complete.js
. These files can be downloaded from the Packt Publishing website at http://www.packtpub.com/support.
The following challenge exercise may require the use of the official jQuery documentation at http://api.jquery.com/.
When the user clicks on a photo, add or remove the
selected
class on the photo<div>
. Make sure this behavior works even for photos added later using the Next Page link.Add a new custom event called
pageLoaded
that fires when a new set of images has been added to the page.Using the
nextPage
andpageLoaded
handlers, show a Loading message at the bottom of the page only while a new page is being loaded.Bind a
mousemove
handler to photos that logs the current mouse position (usingconsole.log()
).Revise this handler to perform the logging no more than five times a second.
Challenge: Create a new special event named
tripleclick...