Skip to content

Commit

Permalink
task 1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaBilynska committed May 29, 2023
1 parent 448b47a commit e2d5aac
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/js/01-gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
// Add imports above this line
import { galleryItems } from './gallery-items';
// Change code below this line

import SimpleLightbox from "simplelightbox";
// Додатковий імпорт стилів
import "simplelightbox/dist/simple-lightbox.min.css";
console.log(galleryItems);

const makeGalleryMarkup = images => {
return images.map(({ preview, original, description }) => {
return `
<li class="gallery__item">
<a class="gallery__link" href="${original}">
<img class="gallery__image" src="${preview}" alt="${description}" />
</a>
</li>
`;
})
.join('');
}

const galleryContainer = document.querySelector('.gallery');
const imagesMarkup = makeGalleryMarkup(galleryItems);

galleryContainer.insertAdjacentHTML('beforeend', imagesMarkup);

const options = {
captionsData: 'alt',
captionDelay: 250,
};

const lightbox = new SimpleLightbox('.gallery a', options);

0 comments on commit e2d5aac

Please sign in to comment.