javascript - Uncaught TypeError: Object [object Object] has no method 'slides' - Stack Overflow

I got this problem when I add this following script in my header.php file. <script type="textj

I got this problem when I add this following script in my header.php file.

<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>

And before "/head" I add this code

<script src=".4.2/jquery.min.js"></script>

When I open the page, it couldn't load the slide, and there was some error in my general.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

There is also a jquery.js in my web directory, but these errors description above are in that file.

I have searched the problem for a couple of days, but I still don't get the solution. Any help would be really appreciated.

I got this problem when I add this following script in my header.php file.

<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>

And before "/head" I add this code

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

When I open the page, it couldn't load the slide, and there was some error in my general.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

There is also a jquery.js in my web directory, but these errors description above are in that file.

I have searched the problem for a couple of days, but I still don't get the solution. Any help would be really appreciated.

Share Improve this question edited May 4, 2012 at 2:53 gdoron 150k59 gold badges302 silver badges371 bronze badges asked May 4, 2012 at 2:46 anjaryesanjaryes 1111 gold badge3 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

You didn't reference the prettyPhotojQuery plugin.

prettyPhoto isn't a function in the jQuery core functions, you need to use the "library" that extends jQuery with that function.

You should add the reference to the plugin right after the jQuery core library:

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

BTW, the code that throws the error isn't in the code you pasted here...

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745412913a4626612.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信