Based on JS, the news list can seamlessly scroll up the instance code and js News list

Source: Internet
Author: User

Based on JS, the news list can seamlessly scroll up the instance code and js News list

When there are a lot of news and there is no limit at all, using scroll is a good choice. This chapter describes how to achieve this through code examples.

The code example is as follows:

<! DOCTYPE html> 

The above code implements the rolling effect of the News list. The following describes the implementation process:

I. Implementation principle:

The general principle is as follows. The demo element has two sub-elements demo1 and demo2, and stores the content in demo1 into demo2. The reason for this is to scroll up, demo2 can be connected to the end of demo1. Otherwise, it will not be seamless rolling, but a rolling gap. When demo1 content is completely blocked, that is, demo1 completely rolled up, demo2 is exactly at the position where demo1 starts to scroll, and then re-sets the scrollTop value of the demo so that the Scroll will come over again, thus achieving seamless scrolling.

This section describes how to seamlessly scroll up the instance code in the News list based on JS. I hope you can apply this code according to your actual needs.

Articles you may be interested in:
  • Seamless JS image scrolling (easy to use)
  • Div + css + js achieve seamless rolling similar to marquee seamless rolling compatible with firefox
  • Js seamlessly scroll up, website announcement effect code
  • Seamless scrolling example sharing of js images at custom speeds
  • Seamless And smooth code scrolling for JS Images

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.