Method _ jquery

Source: Internet
Author: User
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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.