• Resolved timjamz

    (@timjamz)


    Hello! I have been banging on this for awhile, and for all the searching in WP docs/forums and Google, I can’t seem to find the answer. Any help will be GREATLY appreciated.

    I am trying to use jQuery to perform a simple .show and .hide effect in combination with a .hover on a menu to fade subpages. I believe my CSS and HTML are in order, because I get the menus as desired when hovering/etc but Java isn’t fading them… I just want jQuery to fade them in order to be uber cool 😀

    I’ve tried with and without wp_register_script and/or wp_enqueue_script (in either functions.php or header.php) which places the jquery library call in the wp_head section — then called my .hover .show .hide script prior to the wp_head call in my header. I also fixed using $ vice jQuery in the script. No joy in IE7 or FF3. 🙁

    Here’s what I have right now in my template’s header.php:

    <?php wp_enqueue_script('jquery'); ?>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/fademenu.js"></script>

    <?php wp_head(); ?>

    Here’s the content of my script fademenu.js (in my [theme]/scripts folder):

    /* <![CDATA[ */
    jQuery(document).ready(function() {
    jQuery("#fademenu ul").css({display: "none"}); // Opera Fix
    jQuery("#fademenu li").hover(function(){
    jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show('slow');
    },function(){
    jQuery(this).find('ul:first').css({visibility: "hidden"}).hide('slow');
    });
    });
    /* ]]> */

    Am I missing something simple? Does WP 2.7 have issues with jQuery? I’ve seen all kinds of posts indicating jQuery is being implemented in other 2.7 installs… Help! Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter timjamz

    (@timjamz)

    Oh, good grief! Somewhere I saw that my script had to be called before wp_head… Looking back at my post, I thought… that doesn’t make sense! The library needs to be called before my script.

    Placed my script after the wp_head section, and all is well.

    Thanks for looking anyway! 🙂

    thanks
    !!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQuery and WP 2.7’ is closed to new replies.