如何在准备好文档的全屏上单击vimeo Player?

时间:2019-03-28 09:52:13

标签: javascript jquery vimeo-api

我试图在准备好文档的全屏上单击vimeo播放器。
我该怎么办?

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            $('.fullscreen-icon')[0].click(function () {
            });
        });
    </script>
</head>
<body>

<iframe src="https://player.vimeo.com/video/3873878" width="320" height="240" webkitallowfullscreen
        mozallowfullscreen allowfullscreen></iframe>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

但是,问题是文档准备就绪将在iFrame准备就绪之前被触发。因此,父文档首先准备就绪并触发功能。

function reszie() {
            $("iframe")[0].style.height = "100vh"
			$("iframe")[0].style.width = "100%";
      $("button")[0].style.display = "none";
        };
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>

<button onclick="reszie()">Resize<button>
<iframe src="https://player.vimeo.com/video/3873878" style="height:128px;width:256px;" webkitallowfullscreen
        mozallowfullscreen allowfullscreen></iframe>

</body>
</html>