0

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.com/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.

1 Answer 1

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.com/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...

Sign up to request clarification or add additional context in comments.

3 Comments

but if I don't write that (my first code above) additional script in my header.php, all scripts (prettyPhoto,etc) can work fine... the problem show, when I add that script... please give me more explanations.. thnks
@AnjarTriyoko. I don't know it doesn't make sense. Paste all of your code in jsFiddle.net and let me check it out. anyway it's not those lines and you need to add a reference to the plugin.
Thanks for your explanation. Actually this problem showed because of my lack of knowledge of jQuery&friends..:D. The problem has been solved just by removing the addition script reference in my header.php... once again, thanks..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.