HTML JS text left and right scroll plugin

Source: Internet
Author: User

I wrote a lot of plug-ins, but are directly embedded in the project, never took out a separate package into a file, this is the first time, hope is a good start.

A plugin that has long text and can scroll left and right

1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4     <MetaCharSet= "UTF-8">5     <title>Document</title>6 </Head>7 <style>8 Div{9 width:200px;Ten Overflow:Hidden; One     } A span{ - Display:Inline-block; - Word-break:Keep-all;           /*No Line break*/ the White-space:nowrap;          /*No Line break*/ - width:Auto; - text-align: Right; -     } + </style> - <Body> +     <Divclass= "Font-scroll"><span>Silhouette of your silhouette too good-looking, resist tears to dare to look</span></Div> A     <Divclass= "Font-scroll"><span>Silhouette of your silhouette too good-looking, resist tears to dare to look</span></Div> at     <Divclass= "Font-scroll"><span>Silhouette of your silhouette too good-looking, resist tears to dare to look</span></Div> - </Body> - <Scriptsrc= "./jquery.min.js"></Script> - <Scriptsrc= "./font-scroll.js"></Script> - </HTML>
/**magin 2016/8/28*/$(function(){    functionFontleft (e) {$ (E). Children (' span '). CSS (' magin-left ', ' 0px ')) $ (e). Children (' Span '). Animate ({marginleft:parsefloat ($ (e). CSS (' width '))-parsefloat ($ (e). Children (' span '). CSS (' width '))-12            },"Linear",function() {fontright (e); })    }    functionFontright (e) {$ (E). Children (' span '). CSS (' Magin-left ', parsefloat ($ (e). css (' width '))-parsefloat ($ (e). Children (' span '). CSS (' width ')))); $ (e). Children (' Span '). Animate ({marginleft:' 12px '            },"Linear",function() {fontleft (e); })    }    $('. Font-scroll '). each (function(){if($( This). Children (' span '). CSS (' width ') >$ ( This). CSS (' width ') {fontleft ( This)        }    })})

HTML JS text left and right scroll plugin

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.