How to achieve the effect of single-line text up scrolling (with code)

Source: Internet
Author: User
This article introduces to you about how to achieve the effect of single-line text upward scrolling (with code), there is a certain reference value, the need for friends can refer to, I hope to help you.

Recently in an active page, you need a single-line text up-scrolling effect to show the winning announcements.

The effect is as follows:

Don't say much nonsense, put the code directly below.

The HTML code is as follows:

<div class= "notice" >      <div class= "wrap" >     <ul: Style= "{top:noticetop + ' REM '}": Class= "{transitiontop:isactive}" >       <li v-for= "(item, index) in Noticelist": key= "Index" >{{item.phone}} pumped in {{item.prizename}}</li>       <li v-if= "Noticelen > 0" >{{noticelist[0 ].phone}} pumped in {{noticelist[0].prizename}}</li>       <li v-if= "Noticelen = = 1" >{{noticelist[0].phone}} pumped in { {Noticelist[0].prizename}} </li>       <li v-if= "Noticelen = = 0" > Award announcement </li>     </ul>   </div> </div>

The less code is as follows:

. notice{     Display:flex;     Justify-content:center;     Padding-bottom:. 26rem;     img{       width:. 3rem;       Height:. 24rem;     }     . wrap{       position:relative;       Height:.3rem;       Overflow:hidden;       Margin-left:. 15rem;       Font-size:. 24rem;       Color: #391b03;     }     ul{       position:relative;       Top:-.3rem;       li{         height:. 3rem;         Line-height:. 3rem;       }     }     . transitiontop{       transition:top 200ms ease-in-out;     }}

The JS code is as follows:

It should be stated that:
1. Project is based on Vue's syntax
2. Scrolling to the bottom returns a delay in order to be able to scroll to the last one and then return from the last one to the first one.

Related articles recommended:

CSS3 How to implement page scrolling animation effect?

How to make a good-looking button with CSS3?

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.