使用 .trigger('click') 自动加载fancybox [英] Auto load fancybox using .trigger('click')
问题描述
我只是想知道您是否可以帮忙.我正在尝试获取页面渲染后,fancybox 自动加载.但是,我在第 18 行 (/js/fancybox/jquery.fancybox-1.3.3.pack.js).目前,我正在使用 jquery1.4.2版本
点击我<div style="display:none"><div id="container">Fancybox Content Here .... </div>
<script type="text/javascript">$(document).ready(function(){$('#profile').fancybox().trigger('click');});
有趣的是,如果我使用下面的行并在 firebug 中运行它控制台然后它工作!不知道我在这里做错了什么.您的帮助将不胜感激.
$('#profile').fancybox().trigger('click');
谢谢
我遇到了同样的问题.使用解压版本进行测试,我在第 36 行(fancybox 1.3.4)中得到加载未定义".所以我叫$.fancybox.init();"在触发之前,它现在可以正常工作.
I was just wondering if you could please help. I am trying to get the fancybox to load automatically once the page is rendered. However, I got this error message 't is undefined' at line 18 (/js/fancybox/ jquery.fancybox-1.3.3.pack.js). At the moment, I am using jquery version 1.4.2
<a href="#container" id="profile">Click me</a>
<div style="display:none">
<div id="container">Fancybox Content Here .... </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#profile').fancybox().trigger('click');
});
</script>
The funny thing is if I take the line below and run it in firebug console then it WORKS!. Not sure what did I do wrong here. Your helps would be grateful.
$('#profile').fancybox().trigger('click');
Thanks
I got the same problem. Testing with the unpacked version, i got "loading is undefined" in line 36 (fancybox 1.3.4). So I called "$.fancybox.init();" before triggering and it works correctly now.
这篇关于使用 .trigger('click') 自动加载fancybox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!