-1

我是 Javascript/jQuery 的新手。我尝试使用 jQuery fancybox,但我得到了这样的错误。

Uncaught TypeError: Object [object Object] has no method 'fancybox' 。

这是我的代码:

<!DOCTYPE html>
<html>
<head>
<script type = "text/javascript" src = "jquery-1.10.1.min.js"></script>
<script type = "text/javascript" src = "jquery.mousewheel-3.0.6.pack.js"></script>
<link rel="stylesheet" href="source/jquery.fancybox.css" type="text/css" media="screen" />

<script type = "text/javascript">
    jQuery(document).ready(function($) {
        $(".fancybox").fancybox({
            openEffect  : 'none',
            closeEffect : 'none'
        });
    });
</script>

</head>
<body>
<a class="fancybox" rel="gallery1" href="http://farm6.staticflickr.com/5471/9036958611_fa1bb7f827_b.jpg" title="Westfield Waterfalls - Middletown CT Lower (Graham_CS)">
    <img src="http://farm6.staticflickr.com/5471/9036958611_fa1bb7f827_m.jpg" alt="" />
</a>
<a class="fancybox" rel="gallery1" href="http://farm4.staticflickr.com/3824/9041440555_2175b32078_b.jpg" title="Calm Before The Storm (One Shoe Photography Ltd.)">
    <img src="http://farm4.staticflickr.com/3824/9041440555_2175b32078_m.jpg" alt="" />
</a>
<a class="fancybox" rel="gallery1" href="http://farm3.staticflickr.com/2870/8985207189_01ea27882d_b.jpg" title="Lambs Valley (JMImagesonline.com)">
    <img src="http://farm3.staticflickr.com/2870/8985207189_01ea27882d_m.jpg" alt="" />
</a>
<a class="fancybox" rel="gallery1" href="http://farm4.staticflickr.com/3677/8962691008_7f489395c9_b.jpg" title="Grasmere Lake (Phil 'the link' Whittaker (gizto29))">
    <img src="http://farm4.staticflickr.com/3677/8962691008_7f489395c9_m.jpg" alt="" />
</a>
</body>
</html>

可能是什么问题???谢谢。

4

1 回答 1

4

您应该加载 fancybox 脚本,例如:

<script type="text/javascript" src="jquery.fancybox-1.3.4.pack.js"></script>

在此行之后:

<script type = "text/javascript" src = "jquery-1.10.1.min.js"></script>
于 2013-09-10T06:00:13.887 回答