nettsiden/www/js/galleri.js

25 lines
673 B
JavaScript
Raw Normal View History

// #region Modal
var modal = document.getElementById('modal');
var modalClose = document.getElementById('modal-close');
modalClose.addEventListener('click', function() {
modal.style.display = "none";
});
// global handler
document.addEventListener('click', function (e) {
if (e.target.className.indexOf('modal-target') !== -1) {
var img = e.target;
var modalImg = document.getElementById("modal-content");
var captionText = document.getElementById("modal-caption");
modal.style.display = "block";
modalImg.src = img.src;
captionText.innerHTML = img.alt;
}
});
// #endregion
// #region sorting
// #endregion