Grow your CSS skills. Land your dream job.

Javascript and WordPress problem

  • # July 15, 2009 at 6:24 am

    In a site I am building I am trying to include a javascript picture fade in/out effect using jquery. The script is from here: http://malsup.com/jquery/cycle/lite/.

    I have successfully implemented it on a testing page http://www.bazzasblog.co.uk/ but I can’t get it to work on the actual site: http://www.dolphinschool.org.uk/test/.

    As you will see I am using WordPress on the site. I have followed online tutorials (http://diggingintowordpress.com/2009/06/including-jquery-in-wordpress-the-right-way/) about using jquery in wordpress but I am obviously doing something wrong.

    Any help you can give a complete javascript/jquery newbie would be most appreciated.

    # July 15, 2009 at 8:16 am

    According to firebug’s javascript debugger "$ is not a function". So you have a conflict going on with another javascript library in WordPress.
    Try changing it to this:

    Code:
    jQuery(function() {
    jQuery(‘#slideshow1′).cycle();

    function onBefore() {
    jQuery(‘#title’).html(this.alt);
    }
    });

    # July 16, 2009 at 4:51 am

    Thanks for the repsonse. That was one of the things that I read on the web and had tried changing but to no effect.

    Another poster on a different forum told me to call my Javascript file and my images with this: <?php bloginfo(‘template_directory’); ?>/js/jquery.cycle.lite.js

    It is now all working.

    # July 21, 2009 at 7:55 pm

    that’s good to know and I need to play around with that. Personally I’ve had a really difficult time getting jQuery to work in wordpress properly. I finally got my homepage slider to work, but it took a while. Maybe my problem is similar :)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".