Make your image pop

Only available in Pazly Pro ( requires pro or lifetime subscription )

Using this technique you will be able to turn every image on your website into a pop-up for bette visibility. There are 2 things you need to do for this.

1. Add open-modal=true as a custom image attribute, like in the video below. Add this to all images you want to be displayed in a pop-up

2. Copy-Paste the code below in the scripts area of your website. This is only doable in Pazly Pro, so you will need a pro or lifetime subscription for this

<div id="modal" class="fixed hidden z-50 inset-0 bg-gray-900 bg-opacity-60 overflow-y-auto h-full w-full px-4">
    <div class="relative w-10/12 md:w-4/6 top-20 mx-auto">
        <img src="" class="w-full h-full object-center object-cover shadow-lg rounded-md " alt="Image Modal">

// all images inside the image modal content class
const lightboxImages = document.querySelectorAll('img[open-modal="true"]');

const modalElement = element =>
  document.querySelector(`#modal ${element}`);

const body = document.querySelector('body');
// closes modal on clicking anywhere and adds overflow back
document.addEventListener('click', () => { = 'auto'; = 'none';

const modalPopup = document.querySelector('#modal');

// loops over each modal content img and adds click event functionality
lightboxImages.forEach(img => {
  const data = img.dataset;
  img.addEventListener('click', e => { = 'hidden';
    e.stopPropagation(); = 'block';
    modalElement('img').src = img.src;

Here is a small demo on how to do this

Last updated