首先,感谢伟大的“Magnific Popup”插件!我有一个初学者的问题。
我正在使用 iframe
类型。我在 iframe 中展示了几种类型的网站,其中大多数都是响应式的,并且占据了 iframe 的所有宽度。但在某些情况下,当网站没有响应时,我想向 iframe 添加一些特定的类,在其中设置宽度的绝对值。最合适的方法是什么?
$.magnificPopup.open({
items: {
src: myUrl,
type: 'iframe',
class: '.bad-site-class' // Is there something like 'class'?
}
});
谢谢你,祝你秋天愉快!
(Yoo-hoo,这是第 100 个标记为“magnific popup”的问题!:))
最佳答案
您可以使用 markupParse
回调,例如:
callbacks: {
markupParse: function(template, values, item) {
template.find('iframe').addClass('bad-site-class');
}
}
http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
关于javascript - Magnific Popup - 向 iframe 添加额外的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19677110/