scroll to just below my div?
<p>I got a div that expands on a click, sometimes its at the bottom of the page and its close to the bottom. What i want is that when its close to the bottom that it should scroll down just below it. </p>

<p>My solution so far is below. I get how to calculate the values and animate an all but i just dont get why my script wants to scroll to the bottom of the page, it just slams it to the bottom. Any ideas?</p>

<p><strong>EDIT</strong><br />
Doh ofcause its gone scroll to the bottom. Question is how do i scroll so its just below my div by 10px? Im not suppose to say <code>scrollTop: total</code></p>

<p>jquery</p>

<pre><code>       var $ediv = $this.parent('div').find('.order-expand-row');
       var hDiv = $ediv.outerHeight();
       var oDiv = $ediv.offset().top;
       var wHeight = $(window).height();
       var total = hDiv + oDiv + 10;

       if (total &gt;= wHeight) {                                   
          $('html, body').animate({ scrollTop: total }, 600);
       }
</code></pre>
