Adding some text below the video popup

2019-04-13 13:41发布

问题:

I want to add some text below the my video popup, like the example picture:

How can I do that?

My code:

$(document).ready(function () {
    $.magnificPopup.open({
        items:[
            {
                src: 'http://www.youtube.com/watch?v=p_I70TYm9qQ',
                type:'iframe'
            },
        ],
        type: 'iframe'
    });
});

回答1:

By default caption works only with image type.

To make it work with iframe type, you'll need to add element that will hold title to iframe markup and parse it in markupParse callback, e.g.:

callbacks: {
  markupParse: function(template, values, item) {
   values.title = item.el.attr('title'); // will use title attribute of target DOM element
  }
}

Here is example http://codepen.io/dimsemenov/pen/zjtbr