title: Load javascript code after jquery.js has loaded in WordPress site
body: <p>I have a custom jquery-based slider on homepage of a WordPress site. I'm loading jQuery (jquery.js) and the slider js (jquery.advanced-slider.js) using below code in my functions.php file of my theme.</p>
  
  <pre><code>function my_load_scripts() {
    if (!is_admin()) {
      wp_enqueue_script("jquery");
  
      if (is_home()) {
        wp_enqueue_script('theme-advanced-slider', get_template_directory_uri().'/js/jquery.advanced-slider.js', array('jquery'));
        wp_enqueue_script('theme-innerfade', get_template_directory_uri().'/js/innerfade.js', array('jquery'));
      }
    }
  }
  </code></pre>
  
  <p>add_action('wp_enqueue_scripts', 'my_load_scripts');</p>
  
  <p>Now I put the below code in my header.php file BEFORE wp_head();</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var $j = jQuery.noConflict();
  
    $j(document).ready(function () {
      //Slider init JS
      $j(".advanced-slider").advancedSlider({
        width: 614,
        height: 297,
        delay: 1000,
        pauseRollOver: true
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>It's obvious here that my jquery.js and jquery.advanced-slider.js load after the JavaScript code above and thus my slider doesn't work. If I put it after wp_head() call in <code>&lt;head&gt;</code> the slider works.</p>
  
  <p>But if I put it after wp_head() wouldn't that be a hack? I want my code to be clean. As twentyeleven theme clearly says </p>
  
  <pre><code>/* Always have wp_head() just before the closing &lt;/head&gt;
       * tag of your theme, or you will break many plugins, which
       * generally use this hook to add elements to &lt;head&gt; such
       * as styles, scripts, and meta tags.
       */
  </code></pre>
  
  <p>I'm very confused here. I might be missing something very simple clue here. But help me out guys. What would be the best way to put the JavaScript before wp_head() and yet have it load after jquery.js and slider.js have loaded?</p>