In this exercise, you'll modify a carousel application so that when an image in the carousel is clicked, an enlarged image is displayed using animation.

Figure: see image.

1. Open the HTML and JavaScript files in this folder:

exercises\ch09\carousel\

Then, run the application and notice that an enlarged image of the first book in the carousel is displayed.

2. Review the HTML for the application, and notice that it contains an img element with an id of "image" following the heading. Also notice that the href attributes of the < a > elements in the carousel are set to the URL of the enlarged image to be displayed when the associated carousel image is clicked.

3. Code an event handler for the click event of the < a > elements in the list. This event handler should start by getting the URL for the image to be displayed. Then, it should assign this URL to the enlarged image.

4. Add animation to the click event handler so the opacity of the current image is set to 0 and 205 is subtracted from the left margin of the image over a period of 1 second. Use a callback function to reverse this animation. This function should also contain the statement that sets the URL for the enlarged image. The effect will be for the current image to fade out as it slides to the left, and then for the new image to fade in as it slides to the right.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.