this works for me

http://codepen.io/ryanjbonnell/pen/dqsxI

jQuery('.gallery-link').on('click', function () {
    jQuery(this).next().magnificPopup('open');
});

jQuery('.gallery').each(function () {
    jQuery(this).magnificPopup({
        delegate: 'div',
        type: 'image',
        gallery: {
            enabled: true,
            tPrev: '',
            tNext: '',
            tCounter: '%curr% | %total%'
        }
    });
});
Answer from Nikolay Popov on Stack Overflow
🌐
CodePen
codepen.io › bluminethemes › pen › reEJZa
Magnific Popup - Open custom gallery on button click
$(document).ready(function() { $('a.btn-gallery').on('click', function(event) { event.preventDefault(); var gallery = $(this).attr('href'); $(gallery).magnificPopup({ delegate: 'a', type:'image', gallery: { enabled: true } }).magnificPopup('open'); }); });
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup › documentation.html
Magnific Popup Documentation
If popup is already opened - it'll just overwite the content (but old options will be kept). // - first parameter: options object // - second parameter (optional): index of item to open $.magnificPopup.open({ items: { src: 'someimage.jpg' }, type: 'image' // You may add options here, they're exactly the same as for $.fn.magnificPopup call // Note that some settings that rely on click event (like disableOn or midClick) will not work here }, 0); $.magnificPopup.close(); // Close popup that is currently opened (shorthand) /* Methods below don't have shorthand like "open" and "close".
🌐
Stack Overflow
stackoverflow.com › questions › 46327068 › magnific-popup-on-button-click
jquery - Magnific popup on button click - Stack Overflow
September 20, 2017 - $( ".button--video" ).click(function() { $('.video-gallery').magnificPopup({ delegate: 'a', type: 'iframe', tLoading: 'Loading video #%curr%...', mainClass: 'mfp-iframe', gallery: { enabled: true }, iframe: { tError: '<a href="%url%">This video #%curr%</a> could not be loaded.', titleSrc: function (item) { return ''; } } } ); });
🌐
Kriesi
kriesi.at › home › topics › enfold › show gallery in lightbox on button click with magnific popup
Show gallery in lightbox on button click with Magnific Popup - Support | Kriesi.at - Premium WordPress Themes
June 4, 2017 - jQuery(document).ready(function( $ ) { $('.fs-gallery-button').magnificPopup({ items: { src: 'link/to/my/image.jpg' }, type: 'image' // this is default type }); }); I added the fs-gallery-button class to the button and now if I click it it opens the lightbox image for about 1ms and then some ...
🌐
Ima9ines
ima9ines.com › en › how-to-enable-the-next-and-previous-buttons-for-magnific-popup-in-the-product-details-page
ima9ines | How to enable the "Next" and "Previous" buttons for Magnific Popup in the "Product details page"?
January 29, 2018 - add a new script (text in the bold style), in order to open "Magnific Popup" with the "Next" and "Previous" buttons · $(document).ready(function () { $('.thumb-item img').on('click', function () { $('#main-product-img-@Model.Id').attr('src', $(this).attr('data-defaultsize')); $('#main-pro...
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 42
Open/close popup from javascript (without link) · Issue #42 · dimsemenov/Magnific-Popup
May 9, 2013 - I'm working on implementing a login popup window using this framework and stuck with the issue of how to programmably open and close some specified popup without having a corresponding link? Yo...
Author   andronix83
🌐
GitHub
gist.github.com › 0b78cccf0e1554846d50
MagnificPopup Open - not from a link · GitHub
magnific-popup-open · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ·
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › jquery › how-to-use-the-magnific-popup-jquery-plugin
How to Use the Magnific Popup jQuery Plugin? - GeeksforGeeks
July 15, 2025 - It can be used to open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), and photo gallery. It has added animation effects using CSS3 transitions. IN this approach, we have created a small popup using the Magnific Popup library. It includes necessary CSS and JavaScript files from CDNs. A button is provided, and when clicked, it opens a small popup displaying "GEEKSFORGEEKS" and "WELCOME TO GEEKSFORGEEKS".
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 978
how to random magnific popup items in gallery onClick · Issue #978 · dimsemenov/Magnific-Popup
April 21, 2017 - how to random magnific popup items in gallery onClick#978 · Copy link · amine-damani · opened · on Apr 21, 2017 · Issue body actions · i use multipes items popup and I want to change index items whenever click · Sign up for free to join this conversation on GitHub.
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 113
Open Popup (Image Gallery) from Link · Issue #113 · dimsemenov/Magnific-Popup
June 12, 2013 - // Bind Click Handler to Link, then Open Gallery $('.gallery-link').on('click', function () { $(this).next().magnificPopup('open'); }); // Initialize Magnific Popup Gallery + Options $('.gallery').each(function () { $(this).magnificPopup({ delegate: ...
🌐
Stack Overflow
stackoverflow.com › questions › 67416800 › open-magnific-popup
jquery - Open magnific popup - Stack Overflow
$('#open-popup').on('click', function (e) { jQuery('#open-popup').magnificPopup({ type: 'inline', midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
🌐
Minddevelopmentanddesign
minddevelopmentanddesign.com › home › the mind blog › how to create a web accessible modal window with magnific popup
How to Create a Web Accessible Modal Window with Magnific Popup
August 29, 2025 - Magnific Popup gives you a few default content types and ways to initialize the popup. We will be using the ‘inline’ content type and initializing our modal through a button click.
🌐
JSFiddle
jsfiddle.net › phpdeveloperrahul › bdLAN
A basic demo magnific popup - JSFiddle - Code Playground
Introducing the first beta of the editor console - it's going to show you logs, warnings, errors without the need of opening full devtools.
🌐
Kriesi
kriesi.at › home › topics › enfold › open magnific popup automatically when a specific page load
Open magnific popup automatically when a specific page load - Support | Kriesi.at - Premium WordPress Themes
October 20, 2015 - Check the API methods for Magnific Popup – http://dimsemenov.com/plugins/magnific-popup/documentation.html#api · Also, you could create an invisible link linking to that image and make it trigger on load, something like: (function($){ $(window).load(function() { $('.trigger').trigger('click'); }); })(jQuery);
🌐
TutorialsPoint
tutorialspoint.com › how-to-use-the-magnific-popup-jquery-plugin
How to use the Magnific Popup jQuery plugin?
November 21, 2023 - Step 3 In this step, we will add the HTML that has to be show on click to the particular button on the web page. In this example, we will open an iframe video from youtube that opens up on click to the button. The below example will show how to use the magnific plugin to show an iframe video popup ...