Try this:

$.magnificPopup.open({
    items: {
        src: '<div id="test-modal" class="white-popup"><h1>Modal Test</h1><p>Test Some text.</p><p><a class="popup-modal-dismiss">Dismiss</a></p></div>',
        type:'inline'
    },
    modal: true
});

And the fiddle...

Answer from Fabricio on Stack Overflow
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup › documentation.html
Magnific Popup Documentation
When set to true, the popup will have a modal-like behavior: it won’t be possible to dismiss it by usual means (close button, escape key, or clicking in the overlay). This is a shortcut to set closeOnContentClick, closeOnBgClick, showCloseBtn, ...
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup
Magnific Popup: Responsive jQuery Lightbox Plugin
... You have full control of what ... Load content via ajax Load another content via ajax · A modal popup disables the usual ways to close popups....
Discussions

how to load magnific popup modal on page load
I'm trying to load my magnific popup modal on page load, however I can't quite understand the syntax in the documentation. How do I call the modal on page load? My HTML: More on stackoverflow.com
🌐 stackoverflow.com
jquery - show the form response in modal window using Magnific Popup - Stack Overflow
I am trying to submit a form using ajax and show the response on modal window using Magnific Popup. I have posted the code below. In regarding to make it work I have to click "send" button then "po... More on stackoverflow.com
🌐 stackoverflow.com
How to open a magnific popup on page load?
To be honest, I'm not too familiar with Magnific Popup but by the looks of the documentation that sounds right. 2013-09-10T19:26:41.02Z+00:00 ... ya i tried it right after i posted the comment and that was the solution as well. thanks again hehe 2013-09-10T20:25:23.667Z+00:00 ... How would you then set this to only show once. So after its closed the visitor is remembered for say 30 days before it pops up again? 2019-06-14T11:11:08.51Z+00:00 ... I was able to get a timed modal ... More on stackoverflow.com
🌐 stackoverflow.com
Popup/Modal – Magnific Popup – Div content – Okler Themes
Home › Forums › Porto – Responsive HTML5 Template › Popup/Modal – Magnific Popup – Div content More on okler.net
🌐 okler.net
🌐
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 - Modal windows offer a visually ... be quite problematic if not created with accessibility in mind. I’ll show you the method I use when creating accessible modal windows using the Magnific Popup plugin and jQuery....
🌐
GitHub
github.com › dimsemenov › Magnific-Popup
GitHub - dimsemenov/Magnific-Popup: Light and responsive lightbox script with focus on performance. · GitHub
Use native <dialog> element if you need a basic dialog/modal/popup, or my PhotoSwipe library if you need an advanced image gallery. Feel free to email me if you need assistance. Fast, light and responsive lightbox plugin, for jQuery and Zepto.js. Documentation and getting started guide. Examples and plugin home page. More examples in CodePen collection. Optionally, install via Bower bower install magnific-popup or npm: npm install magnific-popup.
Starred by 11.4K users
Forked by 3.4K users
Languages   JavaScript 67.9% | HTML 18.5% | CSS 8.1% | SCSS 5.5%
🌐
CodePen
codepen.io › onlyhouse › pen › PWEJPJ
Popup/Modal - Magnific Popup - Div content
$('.open-popup-link').magnificPopup({ type: 'inline', midClick: true, mainClass: 'mfp-fade' }); ! 999px · Clear · Ctrl Ctrl Space Autocomplete · F Find · G Find Next · ⇧ G Find Previous · ⇧ Opt F Find & Replace · ⇧ F Format Code · [ Indent Code Right ·
🌐
GeeksforGeeks
geeksforgeeks.org › jquery › how-to-use-the-magnific-popup-jquery-plugin
How to Use the Magnific Popup jQuery Plugin? - GeeksforGeeks
July 15, 2025 - Magnific Popup is a fast, light, mobile-friendly and responsive lightbox and modal dialog jQuery plugin. It can be used to open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), and photo gallery.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 40482047 › show-the-form-response-in-modal-window-using-magnific-popup
jquery - show the form response in modal window using Magnific Popup - Stack Overflow
It creates an <div> element that is used for modal dialog. I also added the style for this window. <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://rawgit.com/dims...
🌐
Simmons University
web.simmons.edu › ~grovesd › comm244 › notes › week13 › magnific › magnific
How to Use Magnific | Comm244 Notes
Magnific Popup is a variation of a common way of displaying images or text in a modal window. The effect is usually called a "lightbox", named after one of the original JavaScript libraries that used it. There are many different JavaScript libraries you can use to achieve this same effect.
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › blob › master › website › _includes › examples.html
Magnific-Popup/website/_includes/examples.html at master · dimsemenov/Magnific-Popup
$('.popup-modal').magnificPopup({ type: 'inline', preloader: false, focus: '#username', modal: true · }); $(document).on('click', '.popup-modal-dismiss', function (e) { e.preventDefault(); $.magnificPopup.close(); }); }); </script> </div> ·
Author   dimsemenov
🌐
JQuery
plugins.jquery.com › magnific-popup
Magnific Popup | The jQuery Plugin Registry
Fast, light, mobile-friendly and responsive lightbox and modal dialog plugin. Open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), photo gallery. Animation effects added with CSS3 transitions. For jQuery or Zepto. lightbox popup modal window dialog ...
🌐
cdnjs
cdnjs.com › home › libraries › magnific-popup.js
magnific-popup.js - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
magnific-popup.js · Lightbox and modal dialog plugin. Can display inline HTML, iframes (YouTube video, Vimeo, Google Maps), or an image gallery. Animation effects are added with CSS3 transitions.
🌐
Okler
okler.net › forums › topic › popup-modal-magnific-popup-div-content
Popup/Modal – Magnific Popup – Div content – Okler Themes
<a class="mt-1 mb-1 popup-with-move-anim btn btn-primary" href="#small-dialog">Open with fade-slide animation</a> <!-- Dialog --> <div id="small-dialog" class="dialog dialog-sm zoom-anim-dialog mfp-hide"> <h1>Dialog example</h1> <p>This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show.
🌐
npm
npmjs.com › package › magnific-popup
magnific-popup - npm
June 8, 2024 - Lightbox and modal dialog plugin. Can display inline HTML, iframes (YouTube video, Vimeo, Google Maps), or an image gallery. Animation effects are added with CSS3 transitions. For jQuery or Zepto..
      » npm install magnific-popup
    
Published   Jun 08, 2024
Version   1.2.0
Author   Dmytro Semenov
Top answer
1 of 2
4

Option 1:

Add data-dismiss="modal" to your

<a class="popup-youtube" href="https://www.youtube.com/watch?v=alJ8FmokHBo">Open YouTube video</a>

to close the bootstrap modal.

I forked your JSFiddle to demonstrate this.

Option 2:

If you want to keep the modal open then increasing the z-index (2000 worked for me but the bottom line is it needs to be greater than the modal's z-index) on the Magnific Popupcontainer is the way to go.

<div class="mfp-wrap mfp-close-btn-in mfp-auto-cursor mfp-fade mfp-ready"
    tabindex="-1" 
    style="top: 0px; position: absolute; height: 386px; z-index: 2000">
    <div class="mfp-container mfp-iframe-holder">
        <div class="mfp-content">
            <div class="mfp-iframe-scaler">
                <button class="mfp-close" type="button" title="Close (Esc)">×</button>
                <iframe frameborder="0" allowfullscreen="" src="//www.youtube.com/embed/alJ8FmokHBo?autoplay=1" class="mfp-iframe"></iframe>
            </div>
        </div>
    </div>
</div>

Edit: I just checked and the .modal BootStrap class has a z-index of 1050 and the .mfp-wrap class has a z-index of 1043 which is why the modal is on top.

Here's another JSFiddle with the CSS modification instead of the data-dismiss.

Note that the Magnific Popup close button does not work. It also has a z-index that will need to be changed and there may be others as well. The data-dismiss option will be the cleanest unless you absolutely need the modal to stay open.

2 of 2
-1

Try removing the tabindex="-1" option because this option said that the modal must be over all the things.

🌐
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
🌐
CodePen
codepen.io › SitePoint › pen › Ejxvjr
Delayed Magnific Popup modal
November 14, 2018 - // Popup effect with Magnific Popup // http://dimsemenov.com/plugins/magnific-popup/ function openPopup(){ $.magnificPopup.open({ items: { src: '#popup', }, mainClass: 'mfp-newspaper' }); $("button").prop("disabled", false); } $("button").on("click", function(){ setTimeout(openPopup, 2000); $(this).prop("disabled", true); });
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 796
Magnific-Popup in a bootstrap modal dialog. Close button - Errors · Issue #796 · dimsemenov/Magnific-Popup
May 1, 2016 - I would like to use Magic-Popup in a bootstrap modal. A solution is: . Maybe can be implemented as default. Problem is close button: Uncaught RangeError: Maximum call stack size exceeded...
Author   yourchoice
🌐
Stack Overflow
stackoverflow.com › questions › tagged › magnific-popup
Newest 'magnific-popup' Questions - Stack Overflow
I have a video, uploaded inside the site itself, not on youtube or vimeo, I need to show it in Magnific popup on click. It looks like <video muted allowfullscreen autoplay class="video" ... ... I have thumb slider images with Magnific Popup. When I click the large image, the modal opens (Magnific Popup), and the image loads.