javascript Magnific youtube没有相关视频

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Magnific youtube没有相关视频相关的知识,希望对你有一定的参考价值。

$(".popup-video").magnificPopup({
      type: "iframe",
      mainClass: "mfp-fade",
      removalDelay: 160,
      preloader: false,
      fixedContentPos: false,

      // your default config here

      // All below settings are default except the rel attribute in youtube-src
      // This is here to remove the related videos from showing up after the video ends
      // Adding rel=0 from url in html template stopped autoplay, hence this hack
      iframe: {
        // markup:
        //   '<div class="mfp-iframe-scaler">' +
        //   '<div class="mfp-close"></div>' +
        //   '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
        //   "</div>", // HTML markup of popup, `mfp-close` will be replaced by the close button

        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.com/embed/%id%?autoplay=1&rel=0" // URL that will be set as a source for iframe.
          }
        }
      }
    });

以上是关于javascript Magnific youtube没有相关视频的主要内容,如果未能解决你的问题,请参考以下文章

javascript Magnific增强了内联弹出窗口的链接

javascript 如何在Magnific Popup Gallery中显示图像和视频

php [magnific popup] jquery magnific popup

“magnific.popup.js”的延迟加载

灯箱效果插件Magnific Popup详解

Magnific-Popup Gallery 不会打开两次