How can style popup iframe in Magnific Pop-Up?

verlager picture verlager · Jul 28, 2013 · Viewed 22.1k times · Source

I want to show an iframe as in http://chesstao.com/test.php (click the green box). But I don't see a method or class to style the height and width of the iframe.

HTML: <div>
<a href="games/header-test.php?game=aveskulov" class="my-popup iframe-link">Show iframe popup</a>
</div>

the js:

<!--Magnific-popup-->
<script src="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.8.9/jquery.magnific-popup.min.js" ></script>

<script type="text/javascript"> 

$(document).ready(function() {

$('.iframe-link').magnificPopup({type:'iframe'});

});</script>

the css:

.my-popup {height:900px; width:1200px}

How can I code the style (height and width) for the magnific popup iframe? I am baffled. The style above is simply ignored.

Answer

cw24 picture cw24 · Jan 21, 2014

This isn't a complete answer but it might help.

Change your options to something like this:

$('.iframe-link').magnificPopup({
   type: 'iframe',
   iframe: {
       markup: '<div class="mfp-iframe-scaler your-special-css-class">'+
                        '<div class="mfp-close"></div>'+
                        '<iframe class="mfp-iframe" frameborder="0" allowfullscreen>            </iframe>'+
                    '</div>'
   }   

});

Then in you css Class do something like this:

.your-special-css-class {
    max-width: 320px !important;
    height: 85%;
    margin: auto;
    max-height: 780px;
    padding: 140% 16px 0 13px !important;
}

the important part to adjust the height is the padding....