Javascript 如何使jquery函数一次运行一个

Javascript 如何使jquery函数一次运行一个,javascript,jquery,jquery-plugins,reveal.js,Javascript,Jquery,Jquery Plugins,Reveal.js,我使用它来运行jquery函数: <script type="text/javascript">$('#customer_popup_notes').reveal();</script> <script type="text/javascript">$('#customer_on_hold').reveal();</script> 当页面加载时,如何让它们一次运行一个,而不是同时运行这两个 它们是页面加载时出现的弹出框-因此我想: 第一次加载,

我使用它来运行jquery函数:

<script type="text/javascript">$('#customer_popup_notes').reveal();</script>

<script type="text/javascript">$('#customer_on_hold').reveal();</script>
当页面加载时,如何让它们一次运行一个,而不是同时运行这两个

它们是页面加载时出现的弹出框-因此我想:

第一次加载, 然后,当盒子关闭时,第二个盒子将加载。 等等
您是否尝试过在reveal方法中使用回调

$('#customer_popup_notes').reveal(function(){
  $('#customer_on_hold').reveal();
});

由于reveal没有关于这方面的任何官方文档,我很快就通读了源代码并尝试了一下。希望能有所帮助

$('#customer_popup_notes').bind('reveal:close', function(){
  $('#customer_on_hold').reveal();
})

$('#customer_popup_notes').reveal();
更新:
基于这个代码,你有2个事件:打开:打开,显示:关闭

目前我没有访问基础,所以这是一个基于文档的最佳猜测。 将模态id描述符存储在数组中,并将索引设置为0

var arr = ['#customer_popup_notes', '#customer_on_hold', 'modal3', 'modal4'];
var index = 0;
具有基于索引加载模态并推进索引的函数

function loadModal () {
  $(arr[index]).foundation('reveal', 'open');
  index++;
}
加载初始模态索引=0

loadModal();
单击“关闭分隔缝”模式类时,请等待该模式自动关闭-这是分隔缝的一部分,然后加载阵列中的下一个模式

$(document).on('click', '.close-reveal-modal', function () {
  $(arr[index - 1]).foundation('reveal', 'close');
  if (index < arr.length) { setTimeout(loadModal, 300); }
});

这试图用可点击的div来解释这个概念。

我查看了reveal的源代码,似乎作者没有将其与.animate正确集成,除非我遗漏了什么。你能看一下如何使用.animate进行链接,然后看看这些方法中是否有任何一种对reveal有效吗?我对jquery不太擅长-你能解释一下吗?我的错-我读错了。很抱歉这是你正在使用的吗?我想是的,我从中获得了代码,我已经添加了这个,但是现在它不会在我的代码中关闭。。。我已经复制了你上面的内容,它只显示了第一个one@user2710234-试试我修改过的答案。我刚刚用最新版本的基金会进行了测试。
<div id="customer_popup_notes" class="reveal-modal">
  <h2>Awesome. I have it 1.</h2>
  <a class="close-reveal-modal">&#215;</a>
</div>