Horizontal text scrolling implemented by js

Source: Internet
Author: User

The label I first came up with is <marquee> because it can implement horizontal scrolling. The manager said that its starting position is from the rightmost. Can it be changed to the center or the leftmost. After checking the relevant information, you can see that <marquee> cannot specify the start position. Later, I found a piece of code on the Internet, which was implemented using images. After I changed the image into text, I successfully realized what I wanted. The Code is as follows:
<Style type = "text/css"> # gongao {width: 1000px; height: 30px; overflow: hidden; line-height: 30px; font-size: 13px; font-family: ' '; background: # DDE5ED; color: # 0C77CF; font-weight: bold ;}# gongao # scroll_begin, # gongao # scroll_end {display: inline} </style >$ {affiche. content }$ {affiche. content }$ {affiche. content }$ {affiche. content }$ {affiche. content }$ {affiche. content}
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Here $ {affiche. content} is the text obtained from the database.

The reason why this multi-repeating text is written in the div of scroll_begin is that the length of the text must be greater than the div container of scroll_div. If it is less than div, it will not always scroll.

In other words, the content width of seamless scrolling must be greater than the container width.

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.