title: javascript dollar sign variable not working
body: <p>I have following code in my Wordpress:</p>
  
  <pre><code>(function ($) {
    var $header = $("div.header");
  
    $(window).bind("scroll resize", function () {
      if ($(window).scrollTop() &gt; 30) {
        $("div.header").stop().animate({
          'opacity': 0.24
        }, {
          duration: 1000
        });
      } else {
        $header.stop().animate({
          'opacity': 1
        }, {
          duration: 1000
        });
      }
    });
  })(jQuery);
  </code></pre>
  
  <p>If statement kicks in when supposed but else never...</p>
  
  <p>BUT</p>
  
  <p>If I enclose it with:</p>
  
  <pre><code>jQuery(document).ready(function($) {        
    // code here
  });
  </code></pre>
  
  <p>It's all fine. Why?</p>
  
  <p>Thank you</p>