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
selected
class on the photo<div>
. Make sure this behavior works even for photos added later using theNext 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 aLoading
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 namedtripleclick
that fires when the mouse button is clicked on three times within 500 milliseconds. To test the event, bind atripleclick
handler to the<h1>
element which hides and reveals the contents of<div id="gallery">
.