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