memex/docs/logic/lightbox.js
2018-10-31 03:05:23 +13:00

27 lines
695 B
JavaScript

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}">`;
this.container.style.display = 'block';
}
this.close = function()
{
if (this.container.style.display != 'none')
{
this.container.style.display = 'none';
}
}
}