当前位置: 动力学知识库 > 问答 > 编程问答 >

php - How to make button visible when the youtube video finishes

问题描述:

I have a popup on my PHP website with auto-playing YouTube video, I've put a button to enter the website skipping the popup.

But I want the enter the website button to be visible only after the youtube video ends.

网友答案:

If you know the duration of the video, you can use a setTimeout() JavaScript function to show the skip to enter button after that duration.

$(document).ready(function(){
    setTimeout(function(){
        $(".hidden").removeClass("hidden");
    }, 25000);
});

Fiddle: http://jsfiddle.net/praveenscience/qufb369v/

网友答案:

check this answer: click me

this is the function to check id youtube video has ended (ifram)

function onPlayerStateChange(event) {
  if (event.data == YT.PlayerState.ENDED){
    // your code to run after video has ended
  }
} 
分享给朋友:
您可能感兴趣的文章:
随机阅读: