jquery - 如何为 Magnific Popup 自动播放视频
问题描述
嗨,
我正在使用 magnific popup。但我想为所有浏览器自动播放视频,当打开 magnific popup.see 我正在使用这个 js。
function magnificPopupFn() {
$('.popup-vimeo').magnificPopup({
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: true,
closeOnContentClick: false,
closeBtnInside: true,
closeOnBgClick: true,
callbacks: {
open: function() {
$('html').css('margin-right', 0);
$('body').addClass('noscroll');
$('iframe').attr('allow', 'autoplay');
},
close: function() {
$('body').removeClass('noscroll');
},
}
});
}
magnificPopupFn();
解决方案
在“自动播放政策更改”之后,这不再可能,请参阅https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
推荐阅读
- nativescript-angular - 我如何在 RAD 数据表单中实现价值提供者的属性转换器
- opencart-3 - 如何限制特定类别的 COD
- python - 如何模拟 googleapiclient.discovery.build
- apache-spark - Spark make-distribution with Hadoop 3.1.2
- database - europass db 结构关系或 noSql
- c++ - 运算符(+)连接字符数组中的文本导致内存泄漏
- android - 布局元素的父元素是什么?
- c++ - 生成使用来自应用程序的符号的库
- angular - 将使用 Visual Studio 2017 模板制作的 Angular 7 应用程序部署到 IIS
- maven - 找不到工件并且无法解决依赖关系