I would do this with jQuery (and I bet you're using jQuery for your template too :) )

Be sure you're calling the jQuery library in your page, I would recommend to place it just before the </body> tag and BELOW all the scripts.

for example

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <!-- let's call the following div as the POPUP FRAME -->
<div id="popup">

    <!-- and here comes the image -->
    <img src="http://i.imgur.com/cVJrCHU.jpg" alt="popup">

        <!-- Now this is the button which closes the popup-->
        <button id="close">Close button</button>

        <!-- and finally we close the POPUP FRAME-->
        <!-- everything on it will show up within the popup so you can add more things not just an image -->
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
//your jquery script here
</script>

</body>
</html>

This will show up a piece of code, if you want to simply show an image, put the id="popup" directly on your <img> tag.

Now, let's move to the example... the code is pretty easy to understand:

//with this first line we're saying: "when the page loads (document is ready) run the following script"
$(document).ready(function () {

    //select the POPUP FRAME and show it
    $("#popup").hide().fadeIn(1000);

    //close the POPUP if the button with id="close" is clicked
    $("#close").on("click", function (e) {
        e.preventDefault();
        $("#popup").fadeOut(1000);
    });

});

The script behaves like this: When the page is loaded, the content inside <div id="popup"> show up, and if the button with id="close" is clicked, then the pop up is hidden. Add whatever you want inside this <div id="popup"> and it will show inside the popup.

The CSS: SUPER IMPORTANT!

/*we need to style the popup with CSS so it is placed as a common popup does*/
    #popup {
            display:none;
            position:absolute;
            margin:0 auto;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 9999;
    }

You can see it working along with the HTML on this live example:

http://jsfiddle.net/Lp9edyg5/1/

Answer from Frondor on Stack Overflow
๐ŸŒ
Poper
poper.ai โ€บ image-to-popup
Free Image To Popup Generator by Poper
โ€ข One-click popup generationโ€ข Fully customizable settingsโ€ข Works on any website (HTML, WordPress, Bootstrap, React, jQuery) Image to Popup Generator is an easy-to-use tool that allows you to turn any image into a fully customizable popup ...
๐ŸŒ
Elfsight
elfsight.com โ€บ popup-widget โ€บ templates โ€บ image-popup
Embed Free Image Popup Template on Your Website
September 24, 2025 - Popup details You can layer elements and construct an infinite array of content blocks: title, text, CTA button, redirect link, coupon, form, image, and video. Also, for an improved visual appeal, you can add gaps, separators, and custom HTML and iFrame fields.
Rating: 5 โ€‹ - โ€‹ 397 votes
People also ask

Can I customize the popup?
Yes! You can change size, background, clickability, and more.
๐ŸŒ
poper.ai
poper.ai โ€บ image-to-popup
Free Image To Popup Generator by Poper
Can I add buttons to the popup?
Yes, you can add buttons to the popup! Whether you want a simple call-to-action button or something more advanced, the tool allows you to include interactive buttons that can link to other pages or websites.
๐ŸŒ
poper.ai
poper.ai โ€บ image-to-popup
Free Image To Popup Generator by Poper
Is this tool free to use?
Yes, the Image to Popup Generator is completely free! You can create and customize as many popups as you like without any cost.
๐ŸŒ
poper.ai
poper.ai โ€บ image-to-popup
Free Image To Popup Generator by Poper
๐ŸŒ
Twik
twik.io โ€บ home โ€บ resources โ€บ popup generator
HTML popup and JS popup generator
August 4, 2019 - Change anything in your popup, including text, images, forms, countdown date, images, and even the entire layout.
Top answer
1 of 1
7

I would do this with jQuery (and I bet you're using jQuery for your template too :) )

Be sure you're calling the jQuery library in your page, I would recommend to place it just before the </body> tag and BELOW all the scripts.

for example

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <!-- let's call the following div as the POPUP FRAME -->
<div id="popup">

    <!-- and here comes the image -->
    <img src="http://i.imgur.com/cVJrCHU.jpg" alt="popup">

        <!-- Now this is the button which closes the popup-->
        <button id="close">Close button</button>

        <!-- and finally we close the POPUP FRAME-->
        <!-- everything on it will show up within the popup so you can add more things not just an image -->
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
//your jquery script here
</script>

</body>
</html>

This will show up a piece of code, if you want to simply show an image, put the id="popup" directly on your <img> tag.

Now, let's move to the example... the code is pretty easy to understand:

//with this first line we're saying: "when the page loads (document is ready) run the following script"
$(document).ready(function () {

    //select the POPUP FRAME and show it
    $("#popup").hide().fadeIn(1000);

    //close the POPUP if the button with id="close" is clicked
    $("#close").on("click", function (e) {
        e.preventDefault();
        $("#popup").fadeOut(1000);
    });

});

The script behaves like this: When the page is loaded, the content inside <div id="popup"> show up, and if the button with id="close" is clicked, then the pop up is hidden. Add whatever you want inside this <div id="popup"> and it will show inside the popup.

The CSS: SUPER IMPORTANT!

/*we need to style the popup with CSS so it is placed as a common popup does*/
    #popup {
            display:none;
            position:absolute;
            margin:0 auto;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 9999;
    }

You can see it working along with the HTML on this live example:

http://jsfiddle.net/Lp9edyg5/1/

๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_css_modal_images.asp
How To Create Modal Images
Learn how to create responsive Modal Images with CSS and JavaScript. A modal is a dialog box/popup window that is displayed on top of the current page.
๐ŸŒ
Poper
poper.ai โ€บ guides โ€บ how-to-make-a-popup-image-in-html
How To Make a Popup Image in HTML - Poper
May 8, 2025 - How To Make a Popup Image in HTML: Discover step-by-step instructions to create responsive image popups using HTML, CSS, and JavaScript for an engaging user experience.
๐ŸŒ
HTML Code Generator
html-code-generator.com โ€บ html โ€บ popup-window-generator
Online Browser Popup Window Generator Tool
Simply enter the target URL, window name, size (width and height), and choose how the popup should open via link, button, image, or automatically when the page loads. You can also enable screen centered popups and preview the result in real time. Once ready, copy the automatically generated HTML ...
Find elsewhere
๐ŸŒ
Ricocheting
ricocheting.com โ€บ code โ€บ javascript โ€บ html-generator โ€บ popup-window
Pop Up Window HTML Generator | ricocheting.com
Generate the HTML and JavaScript code for your popup (button at bottom) ... Be aware many new browsers have user settings to prevent the hiding of things like the address and status bar. There is nothing you can do about that. If you need help, image showing the different browser Display Options ...
๐ŸŒ
JCE
joomlacontenteditor.net โ€บ support โ€บ tutorials โ€บ jcemediabox โ€บ create-an-image-popup
Create an image Popup
To add a title and/or caption to the popup, enter text in the Title and Caption fields. To create a gallery of images in the popup, assign each popup link to the same 'group' by giving each link the Group value.
๐ŸŒ
Dimsemenov
dimsemenov.com โ€บ plugins โ€บ magnific-popup
Magnific Popup: Responsive jQuery Lightbox Plugin
Three simple popups with different scaling settings. 1 โ€” fits horizontally and vertically, 2 โ€” only horizontally, 3 โ€” no gaps, zoom animation, close icon in top-right corner. You may put any HTML content in each gallery item and mix content types. In this example lazy-loading of images is enabled for the next image based on move direction.
๐ŸŒ
Groupthought
help.groupthought.com โ€บ pipeline documentation โ€บ tutorials โ€บ how to show an image in a pop-up window
How to show an image in a pop-up window - Pipeline Documentation
<a class="image-link" href="https://cdn.shopify.com/s/files/1/2018/8867/files/matteo-paganelli-39971_800x.jpg"><img src="https://cdn.shopify.com/s/files/1/2018/8867/files/matteo-paganelli-39971_200x.jpg"></a> ... Pipeline uses Magnific popup. The code you add to shop.js is to initialize the ...
๐ŸŒ
DEV Community
dev.to โ€บ themodernweb โ€บ awesome-image-popup-you-have-never-seen-it-before-4deg
How to make this awesome image popup effect - DEV Community
June 6, 2021 - <!-- popup --> <div class="popup"> <!-- top bar --> <div class="top-bar"> <p class="image-name">img1.png</p> <span class="close-btn"></span> </div> <!-- arrows --> <button class="arrow-btn left-arrow"><img src="img/arrow.png" alt=""></button> <button class="arrow-btn right-arrow"><img src="img/arrow.png" alt=""></button> <!-- image --> <img src="img/img1.png" class="large-image" alt=""> <!-- image-index --> <h1 class="index">01</h1> </div> <div class="gallery"> <div class="gallery-image"> <img src="img/img1.png" alt="" class="image"> </div> <div class="gallery-image"> <img src="img/img2.png" a
๐ŸŒ
Htmlpopupwindow
htmlpopupwindow.com โ€บ html-popup-generator.html
Html Popup Generator - HTML Popup Window
Create web image galleries with a fancy overlay effect, in a few clicks without writing a line of code. Just drag and drop your photos into the html popup generator app window, press "Publish" and your own beautiful web gallery will open in the browser instantly!
๐ŸŒ
DEV Community
dev.to โ€บ sarah_chima โ€บ image-popup-on-hover-1kee
Image Popup on hover - DEV Community
October 12, 2018 - I did not know how to do it but ... This technique is placing two images side by side, the thumbnail image(smaller image) and a larger image which will appear when you hover over the thumbnail image....
๐ŸŒ
Helpscoutdocs
creativeminds.helpscoutdocs.com โ€บ creativeminds products documentation โ€บ wordpress plugins documentation โ€บ wp popup plugin (cmp) - use case - adding popups with image, html and video to your site
WP Popup Plugin (CMP) - Use Case - Adding Popups With Image, HTML and Video to Your Site - CreativeMinds Products Documentation
The AdDesigner is a handy tool to generate quick popups. You can customize the size, border, title, font and more. ... Using the controls you can change the way how the popup should look like. All the changes are previewed live in the box labeled Banner preview.
๐ŸŒ
Hashnode
devlawrence.hashnode.dev โ€บ how-to-create-an-image-pop-up-gallery
How to create an image pop-up gallery - Dev Lawrence
August 31, 2022 - In this article, We will be creating a popup image modal using HTML, CSS, and VANILLA JAVASCRIPT. The whole concept of doing this is that when a user visits your website and clicks on an image in the image gallery, a larger version of that image should be opened in a modal.
๐ŸŒ
Nicepage
nicepage.com โ€บ hc โ€บ 123702 โ€บ popup-with-image-and-form-html-code
Popup with image and form - Html Code Example by Nicepage
When using HTML Code Generator you will be able to adjust colors, fonts, header and footer, layout, columns and other design elements, as well as content and images.
๐ŸŒ
Reddit
reddit.com โ€บ r/webdev โ€บ i have developed a responsive popup image gallery in html, check and give you reviews.
r/webdev on Reddit: I have developed a Responsive Popup Image Gallery in HTML, check and give you reviews.
June 13, 2024 - A website builder that lets you download the site as an HTML/CSS template and does not require signing up. ... Looking to create a woo product slideshow (using ACF image) with popup for adding to cart.