• Hello. I’m tryin to put a fade in effect onload of the images of my post, using the jQuerty that comes with WP.

    So i have this in my Header.php :

    <?php wp_enqueue_script('fade', '/javascript/fadein.js', array('jquery')); ?>

    Then the folowing JS in a file : :

    function fade() {
    jQuery('#Picture').load(function(){jQuery("#Picture").fadeIn(600);})
    }

    Then in my post the image is like :

    <img src="http://www.…hop_03.jpg" id="Picture" width="648" height="486" border="0"  />

    But it gives no results. Any idea ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You have to enqueue jQuery itself, before enqueing your script. First, did you do that?

    <?php
    wp_enqueue_script('jquery');
    wp_enqueue_script('fade', '/javascript/fadein.js', array('jquery'));
    ?>

    also, those lines must be located BEFORE
    <?php wp_head(); ?>
    in your theme’s header.php file

    First please confirm you have that in place and working.

    Thread Starter nlex

    (@nlex)

    Thanks a lot for your help.

    No i haven’t done that. I was suspecting something like this but i think the WP document doesn’t mention it ? Or maybe i just didn’t understood…
    Anyway when i look in Safari developement tools (similar to FIreBug or such), i can see the loaded script and i see it loads both jQuery and my ‘fade’ miniscript so i’m not sure thats the problem…

    Anyway i added the line :
    <?php wp_enqueue_script('jquery');?>
    (of course before end of ‘head’)

    But, that doesn’t help ! 🙁

    if you want to check by yourself :
    http://alturl.com/pjwp
    The 1st image should fadein (i know i have a bug in my sidebar but… one things after another…)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘FadeIn Effect using Jquery’ is closed to new replies.