Fancybox 脚本不起作用
我曾多次使用 Fancybox,从未遇到过这个问题。我在标题中包含了 jQuery 和 Fancybox 文件,链接了页面的第一个订单按钮以在 Fancybox 中打开 iframe。然而我似乎根本无法让它工作。它不会打开 iframe,而是直接进入我试图在 Fancybox iframe 内打开的页面。
有人能指出我周一早上犯下的任何明显的错误吗?
测试服务器可以在这里找到:
I have used Fancybox on multiple occasions and never run into this problem. I have included both jQuery and Fancybox files in the header, linked up the first order button the the page to open up an iframe in a Fancybox. However I cant seem to get it to work at all. It doesn't open an iframe and instead goes straight to the page I was trying to open inside the Fancybox iframe.
Can somebody point out whatever blindingly obvious mistake I've made this horrible Monday morn?
Testing server can be found here:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
错误消息为:
Uncaught TypeError: Object #has no method 'fancybox'
这意味着 fancybox 尚未加载。仔细查看您的源代码,我们会看到
您可以看到使用 x-ecmascript 而不是 javascript。改变它,你应该没问题。
The error message is:
Uncaught TypeError: Object #<an Object> has no method 'fancybox'
Which implies that fancybox hasn't loaded. Taking a close look at your source we see
<script type="text/x-ecmascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
which you can see uses x-ecmascript rather than javascript. Change that and you should be fine.您没有将代码放入
ready
处理程序中:You didn't put your code into the
ready
handler:也许把它放在 document.ready 中?
Maybe to put it in document.ready?
使用这个:
jQuery(document).ready(function() {
});
Use this:
jQuery(document).ready(function() {
});