How can I simulate a scroll click using jQuery?

How to simulate a scrollbar click using jQuery? Thus, if the user clicks on the div that says “scroll down,” it will be the same behavior as if he clicked on the down arrow in the browser scroll bar. To use the current behavior of the browser would be optimal, but to do something like $.browser.scrolldown(200,'fast').

Something like $.browser.triggerDownArrowOnScrollBar()it would be sweet!

+3
source share
2 answers

Do you want you to scroll to different points on the page? This can be done as follows:

$.scrollTo('#your-div');

Usage: http://flesler.blogspot.com/2007/10/jqueryscrollto.html

-

, , :

$(window).scroll(function() {
  // your actions here
});
+1

, / :

/* Scroll down 10px */
$.scrollTo($(window).scrollTop()-10);

/* Scroll up 10px */
$.scrollTo($(window).scrollTop()+10);
0

Source: https://habr.com/ru/post/1743338/


All Articles