我正在使用最新Foundation 6.4.x和Light YouTube Embeds script by @labnol。
我在标准的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:此处链接的视频对工作安全(John Oliver)
答案 0 :(得分:0)
尝试使用..来自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>