Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 98863fa

Browse files
Fixing showModal
1 parent 480bae0 commit 98863fa

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

‎app/js/script.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class Photo {
77
constructor(json){
88
Object.assign(this, json);
99
}
10-
/* showModal(){
10+
showModal(){
1111
Swal.fire({
1212
width: '50rem',
1313
imageUrl: this.src.original,
1414
imageWidth: '60%',
1515
showConfirmButton: false,
1616
imageAlt: this.alt
1717
});
18-
} */
18+
}
1919
}
2020

2121
// La API key que pedí a la API de Pexels.
@@ -85,6 +85,8 @@ const generateHTML = (data, photoType) => {
8585
newGalleryItem.innerHTML = `<img src="${photo.src.large}" alt="${photo.alt}"></img>`;
8686
// Y por último le agregamos ese nuevo elemento a la galería.
8787
galleryContainer.append(newGalleryItem);
88+
// Por último, cuando se realiza click sobre un elemento de la galería se lanza el método 'showModal'.
89+
newGalleryItem.addEventListener('click', () => photo.showModal());
8890
});
8991
}
9092

‎dist/script.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /