Support » Fixing WordPress » Jquery In Header Problem

  • Resolved seansean11

    (@seansean11)


    I know this is a commonly talked about issue, but I can not find the solution to my specific case. I have calls to 2 jquery files in my header which run my main navigation and and a jquery slider. Neither seem to be functioning at all in wordpress. I am creating my theme from a static design, and the 2 jquery items functioned perfectly when static. I checked the html of the previewed index.php and the calls for the js are working properly and pulling the file into the header. If you could be so kind, please take a look at my code and let me know if you see anything quirky. As I am still learning, I have spent hours just messing around with this to no avail.

    <?php ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php wp_title( '|', true, 'right' );
    
    	?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <link rel="shortcut icon" href="<?php bloginfo( 'template_directory' ); ?>/img/flavicon.ico" />
    <?php wp_enqueue_script("jquery"); ?>
    
    <?php
    	if ( is_singular() && get_option( 'thread_comments' ) )
    		wp_enqueue_script( 'comment-reply' );
    	wp_head(); ?>
    
    <script type="text/javascript" src="<?php bloginfo("template_url"); ?>/js/menu.js"></script>
    <script type="text/javascript" src="<?php bloginfo("template_url"); ?>/js/s3Slider.js"></script>
    
    <script type="text/javascript">
    $j(document).ready(function() {
       $j('#s3slider').s3Slider({
          timeOut: 6000
       });
    });
    </script>
    
    </head>

Viewing 3 replies - 1 through 3 (of 3 total)
  • try changing $j to jQuery

    Wow, worked like magic. Thanks so much. I was using the tutorial on digwp.com and they mentioned using $j. Should I generally always use the jquery?

    Yup. I know that tutorial. I think you missed one line, where you actually define $j as no-conflict mode (which is what youre trying to achieve). But its not necessary, you just need to replace the “$” in regular jquery code with “jQuery” and youre good 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Jquery In Header Problem’ is closed to new replies.