title: SyntaxError: Expected token '}' and WordPress
body: <p><strong>Edit 3/02/12:</strong> Found another solution that worked by itself without the need for any other functions; see my own answer below.</p>
  
  <hr>
  
  <p><em>I just don't see what's wrong here and have had no luck with the answers to all the other questions titled</em> "SyntaxError: Expected token '}'"</p>
  
  <p>I'm working with a sticky <code>div</code> function that keeps <code>&lt;div class="sticky"&gt;</code> always visible on window scroll.</p>
  
  <p>jQuery 1.7.1 is included by WordPress and loads before the two functions below. All functions load, according to Dev Tools.</p>
  
  <p>A <code>&lt;div class="sticky"&gt;with various html&lt;/div&gt;</code> is placed just about the <code>&lt;/body&gt;</code> tag.</p>
  
  <p>But I get a SyntaxError: Expected token '}' error.</p>
  
  <p>This is in header:</p>
  
  <pre><code>$(document).ready(function(){
      $('.sticky').jsticky({
          marginTop: 0,
      });
  </code></pre>
  
  <p>This main function is included above it:</p>
  
  <pre><code>(function($){
      $.fn.extend({ 
          //plugin name - jsticky
          jsticky: function(options) {
  
              //Settings list and the default values
              var defaults = {
                  marginTop: 0
              };
  
              var options = $.extend(defaults, options);
  
              return this.each(function() {
                  var o = options;
  
                  //Assign current element to variable, in this case is UL element
                  var obj = $(this);   
  
  
      var offset = obj.offset();
      var topOffset = offset.top;
      var marginTop = obj.css("marginTop");
      var marginTopNum = parseInt(marginTop);
  
      var diff = topOffset - marginTopNum;
  
  
      var offset = obj.offset();
                  var topOffset = offset.top;
                  var leftOffset = offset.left;
                  var marginTop = obj.css("marginTop");
                  var marginLeft = obj.css("marginLeft");
  
  
                  $(window).scroll(function() { 
                      var WindowScrollTop = $(window).scrollTop();
                      var scrollTop = WindowScrollTop + o.marginTop;
  
                      if (scrollTop &gt;= topOffset){
  
                          obj.css({
                              marginTop: o.marginTop,
                              marginLeft: leftOffset,
                              position: 'fixed'
                          });
                      }
  
                      if (scrollTop &lt; topOffset){
  
                          obj.css({
                              marginTop: marginTop,
                              marginLeft: marginLeft,
                              position: 'relative'
                          });
                      }
                  });
  
  
              });
          }
      });
  })(jQuery);
  </code></pre>