-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
448b47a
commit e2d5aac
Showing
1 changed file
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|