未捕获的类型错误:对象 [对象对象] 没有方法“幻灯片”

Uncaught TypeError: Object [object Object] has no method 'slides'

本文关键字:对象 幻灯片 有方法 类型 错误      更新时间:2023-09-26

当我在我的头文件中添加以下脚本时,我遇到了这个问题.php。

<script type="text/javascript">
            $(function() {
                    $("#logo a span").css("opacity","0");
                    $("#logo a span").hover(function () {
                        $(this).stop().animate({
                            opacity: 1
                        }, 'slow');
                    },
                    function() {
                        // animate opacity to nill
                        $(this).stop().animate({
                            opacity: 0
                        }, 'slow');
                    });
                });
    </script>

在"/head"之前,我添加了此代码

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

当我打开页面时,它无法加载幻灯片,并且我的一般.js中存在一些错误。

Uncaught TypeError: Object [object Object] has no method 'prettyPhoto'
$.fn.superfish.sfgeneral.js:92
f.Callbacks.njquery.js:2
f.Callbacks.o.fireWithjquery.js:2
e.extend.readyjquery.js:2
c.addEventListener.B
Uncaught TypeError: Object [object Object] has no method 'slides'
$.fn.superfish.sfgeneral.js:45
f.event.dispatchjquery.js:3
f.event.add.h.handle.i

在我的网络目录中还有一个jquery.js,但上面的这些错误描述在该文件中。

我已经搜索了几天的问题,但我仍然没有得到解决方案。任何帮助将不胜感激。

你没有引用prettyPhoto jQuery插件。

prettyPhoto不是jQuery核心函数中的函数,你需要使用该函数扩展jQuery的"库"。

您应该在 jQuery 核心库之后添加对插件的引用:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="{prettyPhoto location}"></script>

顺便说一句,引发错误的代码不在您粘贴在此处的代码中......