Share a jquery today for a multi-line scrolling effect.
I see some forum website above, the announcement office uses more.
Code to copy code as follows
Multi-line scrolling
(function ($) {
$.fn.extend ({
Scroll:function (Opt,callback) {
if (!opt) var opt={};
var _this=this.eq (0). Find ("Ul:first");
var lineh=_this.find ("Li:first"). Height (),
Line=opt.line?parseint (opt.line,10):p Arseint (This.height ()/lineh,10),
Speed=opt.speed?parseint (opt.speed,10): 1000,//scrolling speed, the higher the value, the slower the speed (ms)
Timer=opt.timer?parseint (opt.timer,10): 5000; Time interval for scrolling (milliseconds)
if (line==0) line=1;
var Upheight=0-line*lineh;
Scrollup=function () {
_this.animate ({
Margintop:upheight
},speed,function () {
for (i=1;i
Example Demo
Code to copy code as follows
<div id= "Scrolldiv" >
<ul>
<li> I am jquery multiline scroll bar one </li>
<li> I am jquery multiline scroll bar two </li>
<li> I am jquery multiline scroll bar three </li>
<li> I am jquery multiline scroll bar four </li>
<li> I am jquery multiline scroll bar five </li>
<li> I am jquery multiline scroll bar six </li>
<li> I am jquery multiline scroll bar VII </li>
<li> I am jquery multiline scroll bar eight </li>
</ul>
</div>.
<script type= "Text/javascript" src= "http:/(www.111cn.net)/AJAX.GOOGLEAPIS.COM/AJAX/LIBS/JQUERY/1.7.1/ Jquery.min.js "></script>
<script type= "Text/javascript" >
Multi-line scrolling
(function ($) {
$.fn.extend ({
Scroll:function (Opt,callback) {
if (!opt) var opt={};
var _this=this.eq (0). Find ("Ul:first");
var lineh=_this.find ("Li:first"). Height (),
Line=opt.line?parseint (opt.line,10):p Arseint (This.height ()/lineh,10),
Speed=opt.speed?parseint (opt.speed,10): 1000,//scrolling speed, the higher the value, the slower the speed (ms)
Timer=opt.timer?parseint (opt.timer,10): 5000; Time interval for scrolling (milliseconds)
if (line==0) line=1;
var Upheight=0-line*lineh;
Scrollup=function () {
_this.animate ({
Margintop:upheight
},speed,function () {
for (i=1;i<=line;i++) {
_this.find ("Li:first"). AppendTo (_this);
}
_this.css ({margintop:0});
});
}
_this.hover (function () {
Clearinterval (Timerid);
},function () {
Timerid=setinterval ("Scrollup ()", timer);
}). Mouseout ();
}
})
}) (JQuery);
$ (document). Ready (function () {
$ ("#scrollDiv"). Scroll ({line:4,speed:1000,timer:2000});
});
</script>
From:http://www.111cn.net/wy/jquery/50809.htm
jquery implements multi-line text picture scrolling effect