Exercises
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
selectedclass on the photo<div>. Make sure this behavior works even for photos added later using theNext Pagelink. - Add a new custom event called
pageLoadedthat fires when a new set of images has been added to the page. - Using the
nextPageandpageLoadedhandlers, show aLoadingmessage at the bottom of the page only while a new page is being loaded. - Bind a
mousemovehandler 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 namedtripleclickthat fires when the mouse button is clicked on three times within 500 milliseconds. To test the event, bind atripleclickhandler to the<h1>element which hides and reveals the contents of<div id="gallery">.