如何在按下按钮上的第一个或最后一个项目时使用继续滚动

how to use Continue Scrolling When At First or Last Item On Button Press

我想使用向上、向下键继续滚动,即如果我按下向上然后向上滚动或反之亦然而不是一次单击

示例:

> http://jsfiddle.net/hazim/jLfdf2zh/

看看这个 fiddle:http://jsfiddle.net/jLfdf2zh/2/

//<![CDATA[
$(function () {
    $('#button_up').fadeIn('slow');
    $('#button_down').fadeIn('slow');
    $('#button_down').click(
    function (e) {
        var posY = $('html').scrollTop();
        posY += 300;
        $('html').animate({
            scrollTop: posY
        }, 800);
    });
    $('#button_up').click(
    function (e) {
        var posY = $('html').scrollTop();
        posY -= 300;
        $('html').animate({
            scrollTop: posY
        }, 800);
    });
});
//]]>

更新

http://jsfiddle.net/jLfdf2zh/3/