禁用 Facebox 链接,直到页面加载
我想禁用我的 Facebox 链接,直到页面完全加载,原因是,当我在页面完全加载之前单击 Facebox 链接时,页面会加载不同的页面而不是模式!解决这个问题的最佳方法是什么?
这是facebox脚本
<link href="facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="facebox.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loading_image : 'images/ajax-loading.gif',
close_image : 'images/fb_closelabel.png'
})
})
</script>
这是html
<a href="linktosomewhere.php" rel="facebox">Click to goto somewhere</a>
I would like to disable my facebox links until the page has completely loaded reason being, when I click on a facebox link before the page loads completely, the page loads a different page instead of the modal! What is the best way to fix this problem?
This is facebox script
<link href="facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<script src="facebox.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loading_image : 'images/ajax-loading.gif',
close_image : 'images/fb_closelabel.png'
})
})
</script>
this is html
<a href="linktosomewhere.php" rel="facebox">Click to goto somewhere</a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
所以...链接将不可点击,直到所有图像都已加载,这是在 window.load(...) 上触发的,
将 $('a') 修改为您的 Facebox 链接
So... the links wont be clickable till all the images have loaded which is fired on window.load(...)
modify $('a') to your facebox links
刚刚想出了一个不错的解决方法。根据您正在处理的内容,一个简单的解决方案是将 display:none 设置为相关标签,然后只需将以下代码添加到您的 js 中即可。
在你的html中:
晚了几个月,但希望这对某人有帮助!
Just figured out a decent workaround. Depending on the content you're dealing with, a simple solution is to set display:none to the tag in question, then simply add the following code to your js.
and in your html:
A few months late, but hope this helps someone!
Jay,
为了回答您的问题,以下是我如何设法显示链接,但在加载所有内容后才起作用:
JS:
HTML:
希望这有帮助!
Jay,
In response to your question, here's how I manage to have the link display, but not function until all the content is loaded:
JS:
HTML:
Hope this helps!