memex/docs/logic/lightbox.js

27 lines
727 B
JavaScript
Raw Normal View History

2018-10-30 14:05:23 +00:00
function Lightbox()
{
this.container = null;
this.item = null;
this.install = function()
{
this.container = document.getElementById("lightbox");
this.container.innerHTML += `<div class="lightbox-back" onclick="main.lightbox.close()"></div>`;
this.container.innerHTML += `<div id="lightbox-item" class="lightbox-item"></div>`;
this.item = document.getElementById("lightbox-item");
}
this.load = function(file)
{
this.item.innerHTML = `<img class="lightbox-img" src="${file}" onclick="main.lightbox.close()">`;
2018-10-30 14:05:23 +00:00
this.container.style.display = 'block';
}
this.close = function()
{
if (this.container.style.display != 'none')
{
this.container.style.display = 'none';
}
}
}