title: Detect end of horizontal scrolling div with jQuery
body: <p>So, I've got some data tossed in a div. It's split up into chunks by date. It scrolls horizontally with the use of jQuery and the mousewheel plugin.</p>
  
  <p>I need to fire an event when the div has reached it's terminal point (farthest left, farthest right). I think that it is possible with the way it is currently implemented to calculate when you cannot scroll any further by detecting the data fetched in the mousewheel plugin. I just need a nudge in the right direction. Here's the code that does the horizontal scrolling for me:</p>
  
  <pre><code>$(document).ready(function () {        
      $('#timeline').mousedown(function (event) {
          $(this)
              .data('down', true)
              .data('x', event.clientX)
              .data('scrollLeft', this.scrollLeft);
          return false;
      }).mouseup(function (event) {
          $(this).data('down', false);
      }).mousemove(function (event) {
          if ($(this).data('down') == true) {
              this.scrollLeft = $(this).data('scrollLeft') + $(this).data('x') - event.clientX;
          }
      }).mousewheel(function (event, delta) {
          this.scrollLeft -= (delta * 30);
      }).css({
          'overflow' : 'hidden',
          'cursor' : '-moz-grab'
      });
  });
  </code></pre>
  
  <p>Can anybody give me some direction? Thanks!</p>