Change default scrollbar behavior
Quick question...
Is there any way to change the default behavior of a scrollbar from moving one pixel at a time (continuous motion), to jumping say 100px at a time (less continuous more discrete jump开发者_JS百科s). I have an animation that jumps between pictures and I want to use the scrollbar to show one picture at a time.
Whenever I try changing the behavior of the scrollbar it either jumps all over the place or does some screwy stuff. BTW I'm scrolling the bar, not using arrows to move it. That way I can manually make the animation faster or slower.
Use the Control.ScrollBar.scrollBy()
function to scroll by any number of pixels.
var scrollbar = new Control.ScrollBar('scrollbar_content','scrollbar_track');
$('scroll_down_50').observe('click',function(event){
scrollbar.scrollBy(-50);
event.stop();
});
EDIT: To disable the scrollbar try: scrollbar.disable()
From: http://livepipe.net/control/scrollbar
精彩评论