Javascript achieves seamless scrolling compatible with IE and FF_javascript skills

Source: Internet
Author: User
Js achieves seamless rolling and compatible with IEFF. You can take a look. Principle Analysis:
1. First, set the height or width for the container, such as ul, and set ul height to 40px; overflow: hidden;
2. After the height of the container is set, the content height exceeds 40px, and more than half of the content overflows and is hidden. The scrollTop attribute is available. You can use overflow: scroll to view the effect;
3. Change the value of the scrollTop attribute of the container to move the content up or down a node (the principle of scrolling );
4. When scrollTop is greater than or equal to the height of the node to be rolled, set scrollTop to 0, move the first node in the subnode tree to the end, and start rolling again, the effect of continuous loop scrolling appears.
Html source code

The Code is as follows:





Scroll

Related Article

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.