themes/aurora/assets/js/image-script.js
/** Creates the required lightbox elements (backdrop and image) and returns them in an array. */
Creates the required lightbox elements (backdrop and image) and returns them in an array.
Creates the required lightbox elements ( backdrop and image ) and returns them in an array .
function createLightboxElements() {
		let lightboxImageBackdrop = document.createElement('div');
		lightboxImageBackdrop.classList.add('lightbox-image-backdrop', 'out');
		lightboxImageBackdrop.addEventListener('click', closeLightbox);
		document.body.appendChild(lightboxImageBackdrop);
		let lightboxImage = document.createElement('img');
		lightboxImage.classList.add('lightbox-image');
		lightboxImage.style.display = "none";
		document.body.appendChild(lightboxImage);
		return [lightboxImageBackdrop, lightboxImage];
	}
function createLightboxElements ( ) { let lightboxImageBackdrop = document . createElement ( 'div' ) ; lightboxImageBackdrop . classList . add ( 'lightbox-image-backdrop' , 'out' ) ; lightboxImageBackdrop . addEventListener ( 'click' , closeLightbox ) ; document . body . appendChild ( lightboxImageBackdrop ) ; let lightboxImage = document . createElement ( 'img' ) ; lightboxImage . classList . add ( 'lightbox-image' ) ; lightboxImage . style . display = "none" ; document . body . appendChild ( lightboxImage ) ; return [ lightboxImageBackdrop , lightboxImage ] ; }
Creates the required lightbox elements (backdrop and image) and returns them in an array.
Creates the required lightbox elements ( backdrop and image ) and returns them in an array .
// Create the element that will be the backdrop for our lightbox. // Create the image element that will appear over the top of the document. // I don't use the existing img element so that the document doesn't recalculate // the flow and cause the place where the image was to collapse.