延迟后关闭 fancybox
一位客户让我用一些视频更新他的静态网站。他希望它们“弹出”并在网站上播放。我喜欢 fancybox 主要是因为我对 jquery 很烂,而且它使添加灯箱变得如此简单。我立即安装了它,到目前为止一切都是 100% 完美的。
但他希望 fancybox 窗口在播放剪辑后自动关闭。由于视频只有几个而且很短,所以我打算为每个视频分配时间。我认为最长的是1分30秒,一共5个视频。
我该如何实现呢? fancybox 网站说“在 iframe 中使用 - parent.$.fancybox.close();
”,但我不知道如何解决 jquery 中的延迟问题。任何意见或想法都会很棒。
A client has me updating his static site with a few videos. He wants them to "pop up" and play on the site. I love fancybox mostly because I suck at jquery and it makes adding lightboxes so simple. I immediately installed that and so far everything is 100% perfect.
But he wants the fancybox window to close automatically after the clip is played. Since there are only a few videos and they are really short, I was going to just assign the time for each one. I think the longest is 1 min 30 sec and 5 videos in all.
How could I implement that? The fancybox site says "Within an iframe use - parent.$.fancybox.close();
", but I have no idea how to make that work off of a delay in jquery. Any input or ideas would be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以利用 Javascript 的 setTimeout 功能。
所以大致如下:
You could make use of Javascript's setTimeout functionality.
So something along the lines of:
创建一个函数来关闭所有 fancybox 加载后并为该函数设置超时。
create a function to close all fancybox afterload and set timeout for that function.