AnimateScroll Functionality?

69 views
Skip to first unread message

transoptic

unread,
Oct 7, 2010, 1:55:41 PM10/7/10
to jscrollpane
I was wondering if there was a way to implement the AnimateScroll
function so that it animates to the exact part of the scroll bar in
which you click.


Instead, it seems to animate incrementally, not "zip" to the exact
position I click.



Thanks for any insight

Kelvin Luck

unread,
Oct 7, 2010, 2:24:35 PM10/7/10
to jscro...@googlegroups.com
Hi,

That isn't currently possible and isn't the way that native scrollbars
work so I probably won't implement it as part of the plugin. However,
you could try and implement it yourself something like this (untested):

$(function()
{
var scrollPane = $('.scroll-pane').jScrollPane({clickOnTrack:false,
animateScroll:true});
var api = scrollPane.data('api');
scrollPane.find('jspTrack').bind(
'click',
function(e)
{
var track = $(this);
var percentScrolled = (e.pageY - track.position().top) /
track.height();
api.scrollToY(percentScrolled *
api.getContentPane().height(), true);
}
);
}
);

Hope that this works and is helpful. Looking at it I realise that there
could be a few methods added to the API to make this much easier. I've
added a ticket to github and I'll add these methods when I get a chance:
http://github.com/vitch/jScrollPane/issues/issue/19

Cheers,

Kelvin :)

transoptic

unread,
Oct 7, 2010, 2:53:29 PM10/7/10
to jscrollpane
I'll test that out to see how it works, thanks.

In the meantime, here's a demo to a similar slide effect I'm wanting
to implement: http://www.shimonkarmel.com/GalleryMain.asp?GalleryID=75428&AKey=KWFHSWXN

Also, here's another example I've found: http://jqueryfordesigners.com/demo/slider-gallery.html
Notice how the content, rather than the slider, animates as you click
within the scroll.
Reply all
Reply to author
Forward
0 new messages