dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

www.youtube-nocookie.com #1060

Closed Metis77 closed 6 years ago

Metis77 commented 6 years ago

Is there a way to support iframe youtube from this URL: www.youtube-nocookie.com

Metis77 commented 6 years ago

I found solution:

iframe: {
    markup: '<div class="mfp-iframe-scaler">'+
                '<div class="mfp-close"></div>'+
                '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
                '<div class="mfp-title"></div>'+
                '<div class="mfp-counter"></div>'+
            '</div>',
    patterns: {
        youtube: {
            index: 'youtube.com/', // String that detects type of video (in this case YouTube). Simply via url.indexOf(index).

            id: 'v=', // String that splits URL in a two parts, second part should be %id%
            // Or null - full URL will be returned
            // Or a function that should return %id%, for example:
            // id: function(url) { return 'parsed id'; }

            src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' // URL that will be set as a source for iframe.
        }
    }
},