In this activity, you will refactor the Picsum image gallery using an array of objects in animals.js:
- Create custom
altattributes for each image; - Link the
srcof each image to a localjpgfile; - Link each image so that clicking on the image redirects to the placeholder image on Lorem Picsum.
- Download or fork/clone this Gist into your workspace.
- To this new workspace, add the lorem picsum images. Rename your directories as needed to follow file naming conventions.
- Replace the
picsumIdsarray of numbers (inpicsum-list.jswith thepicsumAnimalsarray of objects inanimals.js. - Make the following upgrades to
picsum-list.jsusingpicsumAnimals:- Refactor the
imglinks so that the imagesrcis hosted from a localimagesdirectory. - Create custom
altattributes for each image using thetitleproperty. For example, instead of "Lorem Picsum Image" for Image 237, try "Cute Puppy Photo". - Wrap
<a>links around each image so that clicking them will redirect the user to the placeholder image on Lorem Picsum.
- Refactor the
When you are finished with the above changes, your gallery images should look like this:
<a href="https://picsum.photos/id/237">
<img src="images/md/237.jpg" alt="Cute Puppy Photo">
</a>- Note: since you are using directories in this activity, you will not be able to use a Gist to save your work. Instead, create a full repo on GitHub.