如何在 Facebox 弹出窗口仍然打开时加载另一个 div?
我刚刚弄清楚如何使用 Facebox。我可以在 Facebox 中打开隐藏的 div,但如何让它转储当前的 div 并加载另一个 div,而不关闭弹出窗口?如果用户单击弹出窗口内的链接,我希望 Facebox 弹出窗口加载另一个 div(同时转储前一个 div)。我已经尝试过这样的事情:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({})
})
</script>
<a href="#div1" rel="facebox">Div1</a>
<div id="div1" style="display:none;">
<a href="#div2" rel="facebox">Load the other div</a>
</div>
<div id="div2" style="display:none;">
<p>Other div</p>
</div>
我不知何故知道事情没那么简单。我已经尝试在网上搜索答案,但没有找到答案。这可能吗?对于 Javascript,我完全是个菜鸟,所以请耐心等待。
I just figured out how to use Facebox. I can open hidden divs in Facebox but how do I get it to dump the current div and load another one without closing the pop-up? I want the Facebox pop-up to load another div (while dumping the previous one) if the user clicks on a link inside the pop-up. I already tried something like this:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({})
})
</script>
<a href="#div1" rel="facebox">Div1</a>
<div id="div1" style="display:none;">
<a href="#div2" rel="facebox">Load the other div</a>
</div>
<div id="div2" style="display:none;">
<p>Other div</p>
</div>
I somehow knew it wasn't this simple. I already tried searching the net for answers but no dice. Is this even possible? I'm a complete noob when it comes to Javascript so please bear with me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经找到答案了。显然,您需要将其绑定到鼠标单击事件并执行递归。我是这样做的:
我在此处找到了答案。
I found the answer already. Apparently, you need to bind it to a mouseclick event and perform recursion. Here's how I did it:
I found the answer here.
通过浏览源代码,我认为您可以只传递一个字符串,如下所示:
From skimming through the source, I think you can just pass a string, like this:
试试这个:
Try this: