我已经搜索和搜索,但只能找到关于这类事情的非常古老的帖子。我要做的是创建多个 Foundation 6 Reveal 模态,这些模态会打开将自动播放的 YouTube 视频,并在模态关闭时停止视频/音频。
这是一个基本的设置。任何帮助都会很棒!
<p><a data-open="videoModal-01">Click me for a modal 01</a></p>
<p><a data-open="videoModal-02">Click me for a modal 02</a></p>
<!-- modal 01 -->
<div class="reveal" id="videoModal-01" data-reveal>
<div class="responsive-embed">
<iframe width="560" height="315" src="https://www.youtube.com/embed/4krs7z2bjlE" frameborder="0" allowfullscreen></iframe>
</div>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
<!-- modal 2 -->
<div class="reveal" id="videoModal-02" data-reveal>
<div class="responsive-embed">
<iframe width="560" height="315" src="https://www.youtube.com/embed/c8aFcHFu8QM" frameborder="0" allowfullscreen></iframe>
</div>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>