Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magnific Popup - add additional class to iframe

First of all , thanks for the great "Magnific Popup" plugin! I have a beginner' question. I'm using an iframe type. I'm showing several types of sites in the iframe , most of them are responsive and takes all the width of iframe. But in some cases when a site is not responsive , i want to add some specific class , in which i set absolute value for width , to the iframe . What is a most proper way to do it?

$.magnificPopup.open({
  items: {              
    src: myUrl,          
    type: 'iframe',
    class: '.bad-site-class' // Is there something like 'class'?
   }
});

Thank you and have a good autumn!

(Yoo-hoo , this is 100th question tagged 'magnific popup'! :) )

like image 562
Ivan Chernykh Avatar asked Dec 06 '22 04:12

Ivan Chernykh


1 Answers

You may use markupParse callback, e.g.:

callbacks: {
   markupParse: function(template, values, item) {
       template.find('iframe').addClass('bad-site-class');
   }
}

http://dimsemenov.com/plugins/magnific-popup/documentation.html#api

like image 79
Dmitry Semenov Avatar answered Dec 08 '22 17:12

Dmitry Semenov