当我隐藏 YouTube 视频时,它会停止播放。但是,Vimeo 视频并非如此。还有其他方法可以停止 Vimeo 视频吗?
最佳答案
首先,为您的 iFrame 添加一个 ID。然后将此添加到您的 javascript 关闭窗口点击功能:
var $frame = $('iframe#yourIframeId');
// saves the current iframe source
var vidsrc = $frame.attr('src');
// sets the source to nothing, stopping the video
$frame.attr('src','');
// sets it back to the correct link so that it reloads immediately on the next window open
$frame.attr('src', vidsrc);
关于javascript - 如何使用 jQuery 停止 Vimeo 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6145990/