Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can style popup iframe in Magnific Pop-Up?

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.

like image 765
verlager Avatar asked Jul 28 '13 19:07

verlager


2 Answers

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....

like image 136
cw24 Avatar answered Sep 20 '22 06:09

cw24


  $(document).ready(function() {
    $('.open-popup-link').magnificPopup({
        type: 'iframe',
        iframe: {
            markup: '<style>.mfp-iframe-holder .mfp-content {max-width: 900px;height:500px}</style>'+ 
                    '<div class="mfp-iframe-scaler" >'+
                    '<div class="mfp-close"></div>'+
                    '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
                    '</div></div>'
        }
    });
  });
like image 29
taijisk Avatar answered Sep 21 '22 06:09

taijisk