ACAD275:
Dev 1a Spring 2023 March 07, 2023 |
Resource -- Demo: jQuery photo gallery: jQuery lecture project -- interactive photo gallery |
Save to your computer photogallery_start.html
jQuery demo -- interactive photo gallery:Please note: This demo is meant to be done AFTER having gone through the second jQuery lecture "jQuery Part 2". The only new concept will be the use of an effect called fadeTo -- that lets you set the opacity of an object. The fadeTo has two parameters -- the length of the animation, and the end opacity. so fadeTo(1000,0.5) would fade the element to 50% opacity over one second... fadeTo(0,1.0) would instantly set the opacity to 100% (over 0ms = instantly). First off, load up the start file photogallery_start.html. Note the page has the images hard-coded in the html. Now perform the following steps inside the document ready jQuery script area provided:
At this point you should have a page that when it loads shows all thumbnails at 50% opacity, when you mouse over a thumb it changes to 100% opacity, and when you mouse out goes back to 50%. And when you click on the second thumb it hides the main photo, sets it to that image, then fades the main photo back in... and changes the caption. To see the page at this step you can load photos2html At this point if you wanted to complete the project you would just add similar bind blocks to thumbs 1, 3, 4 and 5, changing their respective src and captions. |