Vertical scrolling On button click function
<p>I am new to Jquery and did so much research on how to do vertical scrolling on button click function. I reffered to the following link     <a href="http://stackoverflow.com/questions/15806389/vertical-scrolling-using-jquery">Vertical scrolling using jQuery</a>
     In that example they know no. of child elements in the html, In my case I need to know my child elements length from my static helper class . I am wondering how can I declare total items length . Please help.</p>

<pre><code>Here is my Html: 

     &lt;div class="onebysix"&gt;
    &lt;!-- "previous page" action --&gt;
    &lt;a class="top"&gt;
        &lt;img src="scroll-leftnl.png" alt="Left" /&gt;
    &lt;/a&gt;
    &lt;!-- root element for scrollable --&gt;
    &lt;div class="scrollable onebysixmiddle"&gt;
        &lt;!-- root element for the items --&gt;
        &lt;label id="count"&gt;&lt;/label&gt;
        &lt;div id="list" class="items"&gt;
            &lt;% if (Model.ProductNotFound)
               { %&gt;
            &lt;!-- List the retailers as we have none in stock --&gt;
            &lt;%= Html.WidgetProductFoundScrollList(Model) %&gt;
            count++;
            &lt;% }
               else
               { %&gt;

            &lt;%= Html.WidgetProductFoundScrollList(Model)%&gt;
            count++;
            &lt;% } %&gt;

        &lt;/div&gt;
    &lt;/div&gt;

    &lt;!-- "next page" action --&gt;
    &lt;a class="bottom"&gt;
        &lt;img src="hscroll-rightnl.png" alt="Right" /&gt;
    &lt;/a&gt;


   My Jqeury:

         &lt;script type="text/javascript"&gt;

// get the number of .child elements
    var totalitems = items.length; // 
// get the height of .child
var scrollval = 6;
// work out the total height.
var totalheight = (totalitems * scrollval) - ($("#items").height());

$(document).on("click", "#bottom", function () {
    var scrollval = 6;
    // this gives us the current scroll position
    var currentscrollval = $('#items').scrollTop();

    $('#parent').scrollTop(scrollval + currentscrollval);
});

if (currentscrollval == totalheight) {
    $(this).hide();
}
else {
    $("#top").show();
}


// hide/show buttons
if ((scrollval + currentscrollval) == scrollval) {
    $(this).hide();
}
else {
    $("#bottom").show();
}

    //]]&gt;
&lt;/script&gt;
</code></pre>
