title: JQuery variable: how to convert positive height into negative margin?
body: <pre><code>&lt;script&gt;
      $(document).ready(function () {
          var footerheight = $('#footer').height();
          $('#footer').css('height', footerheight);
          $('#footer').css('marginTop', footerheight);
          $('#nonfooterinner').css('paddingBottom', footerheight);
      });
      $(window).bind("resize", function () {
          var footerheight = $('#footer').height();
          $('#footer').css('height', footerheight);
          $('#footer').css('marginTop', footerheight);
          $('#nonfooterinner').css('paddingBottom', footerheight);
      });
  &lt;/script&gt;
  
  &lt;body&gt;
      &lt;div id="nonfooterouter"&gt;
          &lt;div id="nonfooterinner"&gt;
              body
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="footer"&gt;
          xxx
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>This script grabs the height of the #footer div and sets it as the bottom padding of the inner body wrapper (#nonfooterinner) and the top margin of the #footer. However, the top margin of the #footer needs to be the negative value of that number. How can I convert the variable "footerheight" in the script to a negative number just for the marginTop value?</p>