开发者

jscrollpane arrow button

I am using jscrollpane with arrows (only scrolling vertically). I have two buttons on my page and I want those buttons to work the same way the scroll arrow vertical buttons (up 开发者_高级运维and down) are working.

http://jscrollpane.kelvinluck.com/ (download link)


You can use the jScrollPane API and the scrollBy method to accomplish this. I have put together an example on jsfiddle.net:

http://www.jsfiddle.net/gLRYu/2/

The code from my example looks like this (and relies on ids of "scroll-up" and "scroll-down" being added to the links on the page):

var api = $('.scroll-pane').jScrollPane().data('jsp');
$('#scroll-up').bind(
    'click',
    function()
    {
        api.scrollByY(-10);
        return false;
    }
);
$('#scroll-down').bind(
    'click',
    function()
    {
        api.scrollByY(10);
        return false;
    }
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜