Skip to content

Commit

Permalink
more attempts at Lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmiller7 committed Jan 25, 2021
1 parent 22a9145 commit a61ba2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var s3 = new AWS.S3({
viewAlbum('bh6');
// viewAlbum('bh5');

$('.image').lazy();
$('.image').Lazy();

// Used to create HTML for our images
function getHtml(template) {
Expand All @@ -49,7 +49,7 @@ function viewAlbum(albumName) {
return;
}
return getHtml([
'<div class="image" style="background-image: url(' + photoUrl + ');" data-url="' + photoUrl + '"></div>',
'<div class="image" style="background-image: url(' + photoUrl + ');" data-src="' + photoUrl + '"></div>',
]);
});
document.getElementById(albumName).innerHTML = getHtml(photos);
Expand All @@ -61,7 +61,7 @@ $(document).on('click', function(event) {
if ($(event.target).attr('class') == 'image') {
$('#modal').show();
var top = 'calc(5% + ' + (window.scrollY) + 'px)';
$('#modal-img').attr('src', $(event.target).attr('data-url'));
$('#modal-img').attr('src', $(event.target).attr('data-src'));
$('#modal').css('top', top);
$('#modal-background').show();
}
Expand Down

0 comments on commit a61ba2f

Please sign in to comment.