我也有同样的问题。 我找到的解决方案。
您需要将第二个模态放在第一个模态样本中:
<p><a data-open="exampleModal2">Click me for a modal</a></p>
<!-- This is the first modal -->
<div class="reveal" id="exampleModal2" data-reveal>
<h1>Awesome!</h1>
<p class="lead">I have another modal inside of me!</p>
<a class="button" data-open="exampleModal3">Click me for another modal!</a>
<button class="close-button" data-close aria-label="Close reveal" type="button">
<span aria-hidden="true">×</span>
</button>
<div class="reveal" id="exampleModal3" data-reveal data-multiple-opened="true">
<h2>ANOTHER MODAL!!!</h2>
<button class="close-button" data-close aria-label="Close reveal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
`
https://jsfiddle.net/noxquws1/22/
@nbeltran解决方案
我发现在 ajax 加载的内容上防止这种情况的解决方案是使用以下方法打开模态:
函数 openMyModal(){
var modal = new Foundation.Reveal( $( '#myModal' ) );
modal.open();
}
函数 openMyOtherModal(){
var modal = new Foundation.Reveal( $( '#myOtherModal' ) );
modal.open();
}
这对我有用并防止打开背面的模态,希望这有帮助
这似乎是一种边缘情况,上面的示例应该在这些情况下修复它。 谢谢@adnhack!