How do I simulate a scrollbar click with jQuery? So, if a user clicks on a div that says "scroll down," it'll be the exact same behavior as if he/she clicked开发者_开发百科 on the down arrow of the browser's scrollbar. Using the current browser's behavior would be optimal, vs. doing something like $.browser.scrolldown(200,'fast')
.
Something like $.browser.triggerDownArrowOnScrollBar()
would be sweet!
Do you mean that you want to scroll to different points on the page? This can be done like this:
$.scrollTo('#your-div');
Using: http://flesler.blogspot.com/2007/10/jqueryscrollto.html
-
If you want to find when the user scrolls, you can use:
$(window).scroll(function() {
// your actions here
});
By the sounds of it, you just want to scroll the page up/down by a fixed amount:
/* Scroll down 10px */
$.scrollTo($(window).scrollTop()-10);
/* Scroll up 10px */
$.scrollTo($(window).scrollTop()+10);
精彩评论