php-gallery/Flyout/flyout.js

55 lines
1.6 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
var flyoutRoot = document.getElementById("#flyoutRoot");
var flyoutDim = document.getElementById("#flyoutDim");
var flyoutHeader = document.getElementById("#flyoutHeader");
var flyoutDescription = document.getElementById("#flyoutDescription");
var flyoutActionbox = document.getElementById("#flyoutActionbox");
});
function flyoutShow(header, description, actionbox) {
2022-08-08 18:59:40 +00:00
// Hide overflow
document.querySelector("html").style.overflow = "hidden";
// Checking if actionbox is set
if (typeof actionbox === 'undefined') {
flyoutActionbox.style.display = "none";
} else if (actionbox == "") {
flyoutActionbox.style.display = "none";
} else {
flyoutActionbox.style.display = "block";
}
// Set information in flyout
flyoutHeader.textContent = header;
flyoutDescription.textContent = description;
2022-08-07 17:28:21 +00:00
$(flyoutActionbox).html(actionbox);
// Show the flyout
2022-08-14 16:43:54 +00:00
flyoutRoot.style.display = "block";
// Show the dim
flyoutDim.style.display = "block";
setTimeout(function(){
// Show the flyout
flyoutRoot.style.transform = "translateX(-50%) scale(1)";
flyoutRoot.style.bottom = "1rem";
// Show the dim
flyoutDim.style.opacity = "1";
}, 1);
};
function flyoutClose() {
2022-08-08 18:59:40 +00:00
// Show overflow
document.querySelector("html").style.overflow = "auto";
// Hide the flyout
flyoutRoot.style.transform = "translateX(-50%) scale(0.5)";
flyoutRoot.style.bottom = "-20rem";
// Hide the dim
flyoutDim.style.opacity = "0";
setTimeout(function(){
// Hide the flyout
flyoutRoot.style.display = "none";
// Hide the dim
flyoutDim.style.display = "none";
}, 500);
};