title: Unsticking div when it hits footer
body: <p>I have a div that sticks to the bottom of the screen and would like to unstick it once it hits footer. I get it to stick but once it scrolls down to footer it doesn't unstick.</p>
  
  <pre><code>var scrollTop = $(document).scrollTop();
  var div = $('.floating-div');
  var footer = $(document).outerHeight() - $('#footer').outerHeight() - div.outerHeight();
  
  
  function stickyDiv() {
  
  
      if (scrollTop &lt; footer) {
          div.addClass("sticky");
  
      }if (scrollTop &gt;= footer) {
          div.removeClass("sticky");
          div.css({
              position: "absolute",
              top: footer + "px"
          });
      }
  }
  
  
  $(document).scroll(function () {
      stickyDiv();
  });
  </code></pre>
  
  <p><a href="https://jsfiddle.net/OpuLance/ce97999q/24/" rel="nofollow">Here's my fiddle</a></p>