cancel
Showing results for 
Search instead for 
Did you mean: 

how to add an external iframe in the magento 2 gallery?

how to add an external iframe in the magento 2 gallery?

I need add an external iframe in product gallery, but my code is not working in product configurable. Thanks

$(document).on('gallery:loaded', function () {
    var $fotorama = jQuery('div.gallery-placeholder > div.fotorama');
    var fotorama = $fotorama.data('fotorama');
    $fotorama.on('fotorama:load', function fotorama_onLoad(e, fotorama, extra) {
        if (extra.frame.type === 'iframe') {
            extra.frame.$stageFrame.html('<iframe align="middle" type="text/html" width="100%" height="100%" src="' + extra.frame.src + '" frameborder="0" scrolling="no" allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>');
        }
    });
    fotorama.push({
        thumb: '',
        'src': '',
        type: 'iframe',
        caption: ''
    });
});
UW