This article mainly introduces how to use the jqueryscroll () method to distinguish the browser's horizontal and vertical scroll bars. If you need it, you can refer to jquery in the scroll () event, I want to judge whether the current scroll bar is still vertical;
I started to use the global variable to record the scrollTop value for determination. If the front and back values are not changed, the system will scroll horizontally,
However, if there are multiple scroll bars on the page, multiple global variables are required to control them. How can this problem be determined?
Scroll jquery differentiate between horizontal and vertical scroll bars
Solution:
Each sets the scrollLeft/scrollTop of the selected object of the selector at one time, and then binds the scroll event. When triggered, obtain the scrollLeft/scrollTop and the initialized scrollLeft/scrollTop to determine whether it is horizontal or vertical, update the scrollLeft/scrollTop of OSS at the same time.
The Code is as follows:
111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111
1111111111111111111