Js text horizontal scrolling effect, js horizontal scrolling

Source: Internet
Author: User

Js text horizontal scrolling effect, js horizontal scrolling

This article shares the js text horizontal scrolling special effect code. The specific implementation content is as follows:

Page Layout 

<Div id = "scroll_div" class = "fl"> <div id = "scroll_begin"> congratulations, 793765 *** received the <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations, 793765 *** received the <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations, 793765 *** received the <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations, 793765 *** received <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations, 793765 *** received <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations, 793765 *** received <span class = "pad_right"> 50 yuan giant node card reward </span> congratulations 793765 *** get <span class = "pad_right"> 50 yuan giant node card reward </span> </div> <div id = "scroll_end"> </div>/ div>

Style:

.pad_right{ padding-right:2em;}#scroll_div {height:26px;overflow: hidden;white-space: nowrap;width:535px;margin-left:10px;}#scroll_begin,#scroll_end {display: inline;}

Js Code:

// Function ScrollImgLeft () {var speed = 50; var MyMar = null; var scroll_begin = document. getElementById ("scroll_begin"); var scroll_end = document. getElementById ("scroll_end"); var scroll_div = document. getElementById ("scroll_div"); Aggregate = aggregate; function Marquee () {if (scroll_end.offsetWidth-scroll_div.scrollLeft <= 0) scroll_div.scrollLeft-= aggregate; else scroll_div.scrollLeft ++;} MyMar = setInterval (Marquee, speed); scroll_div.onmouseover = function () {clearInterval (MyMar);} scroll_div.onmouseout = function () {MyMar = setInterval (Marquee, speed) ;}} ScrollImgLeft ();

The above shows how to easily implement the js text lateral scrolling effect. You can add the js text lateral scrolling effect to Your webpage.

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.