Modal view, navbar, js folder structure
This commit is contained in:
25
www/js/galleri.js
Normal file
25
www/js/galleri.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// #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
|
Reference in New Issue
Block a user