youtube视频ID完成后,如何使fancybox自动关闭? [英] How make fancybox auto close when youtube video id done?

查看:151
本文介绍了youtube视频ID完成后,如何使fancybox自动关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在YouTube视频结束时自动关闭fancybox?

How i can make fancybox auto close when youtube video ended?

推荐答案

这并不像听起来那么简单:

This isn't as simple as it sounds:

  • 首先确定您要使用embed还是iframe播放器.
  • 按照嵌入式播放器API "onComplete" fancybox回调函数来设置播放器.
  • 在回调中,确保添加一个onStateChange事件侦听器,以便可以确定视频何时结束(值为零表示视频已结束)
  • 一旦发现视频已结束,请使用$.fancybox.close方法关闭弹出窗口
  • First determine if you are going to use the embed or iframe player.
  • Follow the embed player API or iframe player API examples to initialize the API.
  • Use the "onComplete" fancybox callback functon to set up the player once the popup is open.
  • In the callback, make sure you add an onStateChange event listener so you can determine when the video has completed (the value of zero means the video has ended)
  • Once you find that the video has ended, then use the $.fancybox.close method to close the popup

或者,您可以让用户关闭弹出窗口.

or, you could just let the user close the popup.

这篇关于youtube视频ID完成后,如何使fancybox自动关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆