Read in Other Languages: Ukrainian, English.
goit-js-hw-07 repository was created.GitHub Pages .Prettier . gallery-items.js file contains an array galleryItems , which contains objects with image information: small (preview), original (large) and description. We have already connected it to each of the JS project files. Create a gallery with the possibility of a click on its elements and view a full -size image in a modal window. See the demo video of the gallery.
Complete this task in 01-gallery.html and 01-gallery.js . Break it up into a few sub -calls:
galleryItems data array and the gallery element is provided.div.gallery and receiving a large image url ..min ) to the project.src element <img> in the modal window before opening. Use a ready -made modal window marking with BasiclightBox library examples. The original image reference must be stored in the source Data Attribute on the <img> item and indicated in href link. Do not add other HTML tags or CSS classes except those contained in this template.
< div class =" gallery__item " >
< a class =" gallery__link " href =" large-image.jpg " >
< img
class =" gallery__image "
src =" small-image.jpg "
data-source =" large-image.jpg "
alt =" Image description "
/>
</ a >
</ div >Please note that the image is wrapped in a link, so the user will be redirected to another page by default. Prohibition of this default behavior.
️ The following functionality is not required for the task, but will be a good extra practice.
Add the closure of the modal window after pressing the Escape key. Make the keyboard listening to only as long as the modal window is open. Basiclightbox libraries contain a method for software closure of the modal window.
SimpleLightbox LibraryMake the same gallery as in the first task, but using the SimplelightBox library, which will take the clicks on the images, discovering and closing the modal window, as well as shaking images with the keyboard.
It is necessary to change the gallery card marking slightly, use this template.
< a class =" gallery__item " href =" large-image.jpg " >
< img class =" gallery__image " src =" small-image.jpg " alt =" Image description " />
</ a > Complete this task in 02-lightbox.html and 02-lightbox.js . Break it up into a few sub -calls:
galleryItems data array and the gallery element is provided. Use a ready -made code from the first task.simple-lightbox.min.js and simple-lightbox.min.css .div.gallery . To do this, get acquainted with SimplelightBox documentation - first of all, USAGE and MARKUP sections.alt . Let the signature be from below and appear in 250 milliseconds after the image is opened.