使用Light YouTube嵌入模式(从基金会透露) - 如何停止模式窗口关闭后的视频播放?
问题描述:
我正在使用最新的Foundation 6.4.x和Light YouTube Embeds script by @labnol。使用Light YouTube嵌入模式(从基金会透露) - 如何停止模式窗口关闭后的视频播放?
我用这个代码在一个标准的HTML页面:
<button data-toggle="animatedModalVideoTest1" class="hollow button expanded alert" href="##">View video</button>
和相应的基金会透露模式是这样的部分:
<div class="reveal" id="animatedModalVideoTest1" data-reveal data-close-on-click="true" data-animation-in="fade-in" data-animation-out="fade-out">
<button class="button float-right" data-close type="button">
<span aria-hidden="true">×</span> Close modal window
</button>
<div class="responsive-embed">
<div class="youtube-player" data-id="xecEV4dSAXE"></div>
</div>
当我点击 “关闭窗口” ,视频在后台继续播放。 任何JS亲谁可以提出一个想法如何制止这种将不胜感激:-)
PS:这里联动录像是安全工作(约翰·奥利弗)
答
尝试使用..this从链接zurb-forum: https://foundation.zurb.com/forum/posts/39375-stop-video-when-closing-a-reveal-modal-with-foundation-6 ..适合我!
将data-reset-on-close="true"
插入您的标记。
例
<div class="large reveal" id="myvideo" data-reveal data-reset-on-close="true">
<iframe width="560" height="315" src="https://www.youtube.com/embed/xxxyyyzzz?rel=0&showinfo=0" frameborder="0" allowfullscreen=""></iframe>
<button class="close-button close-reveal-modal" data-close aria-label="Close reveal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>