自动 Javascript 视频弹出窗口
我需要自动弹出视频,最好是在灯箱中。需要在用户第一次访问页面时自动弹出,播放视频然后关闭。如果需要的话,我还需要一个按钮来再次播放。我也只希望该视频在用户第一次访问主页时播放,因此当您导航回主页时,它不会再次播放。
I need a video to automatically pop up, ideally in a lightbox. It needs to automatically pop up when a user first visits the page, play the video then close. I also need a button to play again if needed. I also only want this video to play the first time a person visits the homepage, so when you navigate back to the homepage it will not play again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
狄奥丢斯的观点很好。堆栈溢出社区是为了帮助具体问题,而不是互相写程序。
您有很多需求,我会尽力帮助您解决这些需求:
嵌入视频可能是一个挑战。快速搜索 TheGoogle(嵌入视频)给我这个链接:
我
没有读过,但是重点是您可以找到许多用于视频嵌入的资源。
灯箱
有许多灯箱脚本( http://www.lokeshdhakar.com/projects/lightbox2/ ),您将不得不费力地浏览它们才能找到您喜欢的一个。
自动弹出
如果您使用 jQuery,我建议您使用
jQuery.ready
函数。存储状态
要查看用户之前是否访问过主页,我建议设置一个 cookie。
http: //www.quirksmode.org/js/cookies.html
Diodeus has a good point. The stack overflow community is to help specific questions, not to write programs for each other.
You have a number of needs, and I will try to help you sort them out:
Embedding videos can be a challenge. Quickly searching TheGoogle (embed a video) gives me this link:
http://www.hunlock.com/blogs/Everything_You_Ever_Needed_To_Know_About_Video_Embedding
I did not read it, but the point is you can find many resources for video embedding.
Lightbox
There are many lightbox scripts ( http://www.lokeshdhakar.com/projects/lightbox2/ ), you will have to slog through them to find one that you like.
Automatic Popup
If you're using jQuery I would suggest the
jQuery.ready
function.Stored State
To see if a user has visited the homepage before, I would suggest setting a cookie.
http://www.quirksmode.org/js/cookies.html