Determining when the user has scrolled to the end of a DIV
<p>My page has a DIV, with overflow and I've placed two buttons on either side of the div to act as secondary scrolling methods.</p>

<p>When pressing the left button, the following script is run and seems to work perfectly:</p>

<pre><code>        function slideLeft() {
        if ($("#divfieldWidgets").scrollLeft() == 0) {
            $('#divScrollWidgetsLeft').animate({ opacity: 0.1 }, 250);
            window.clearInterval(animationHandler);
        }
        $('#divfieldWidgets').animate({ scrollLeft: "-=100px" }, 250);
    }
</code></pre>

<p>However I just can't seem to be able to find a method to determine when the DIV has hit it's limit when scrolling right.</p>

<p>I'm pretty sure I need some calculation based on $("#divfieldWidgets").scrollLeft() and $("#divfieldWidgets").width(), but all arithmetic calculations I've performed on those two values don't yield any results that show any relation to the width, it's maximum, etc, etc.</p>

<p>There is ONE final option I thought of, and that's storing the current scrollLeft value in a temporary variable and comparing the new value; if there's no change, then it's reached the end but I'm sure there must be a more cleaner way of achieving this.</p>

<p>Any thoughts?</p>
