有没有办法检测用户何时按下全屏按钮?在他们的API网站上找不到任何关于它的信息......
答案 0 :(得分:1)
我尝试了很多时间来检测vimeo播放器上的全屏按钮,但没有成功。 但我发现其他解决方案对我有用:
$(window).resize(checkResize);
function checkResize(){
if (
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement
){
// action for fullscreen enable
}else{
// action for fullscreen disable
}
}
答案 1 :(得分:0)
这是我完成检测嵌入式(iframe)Vimeo视频是否为全屏的方式(需要jQuery):
$(function(){
var checkVimeoFullscreen = setInterval(function(){
var winWidth = $(window).width(); // Get the full window width
var vimeoWidth = $('iframe[src*="vimeo"]').width(); // Get the width of the Vimeo iframe
if (winWidth == vimeoWidth){ // if the Vimeo iframe and the window width match, you're in fullscreen
console.log("Vimeo is in fullscreen mode.");
} else {
console.log("Vimeo is not in fullscreen mode.");
}
},500); // You can change the interval if you want, but this worked for me
});
答案 2 :(得分:-1)
你可以这样做:
$('button.fullscreen[data-title-fullscreen][data-title-unfullscreen]').click(function(){
//DO something here
});