title: move background image based on browser width
body: <pre><code>.leavesbg {
    background: #f7fff7 url(/images/leaves4.png) repeat-y fixed 480px top;
  }
  </code></pre>
  
  <p>So if the page is being viewed at greater than 800px wide, I'd like to move the bg image half that much further to the right. That is to say, if they were viewing it in 1024x640 for example, I'd like to add 112 ((1024-800)/2) to the width (so <code>... fixed 592px top;</code></p>
  
  <p>Here's my jquery attempt to move it </p>
  
  <pre><code>function moveBG() {
      var bgoffset =480;
      var pagewidth = $('body').width();
  
      if (pagewidth&gt;800) {
          bgoffset=pagewidth-bgoffset;
          bgoffset=bgoffset/2;
      }
      $('.leavesbg').css(background-position: bgoffset +'px top');
  }
  
  
      $(document).ready(function(){
      moveBG();
      $(window).resize(moveBG);
  
  });
  </code></pre>
  
  <p>I expect I'm just forgetting something simple, but I'm still relatively new to jQuery.</p>