jquery implements multi-line text picture scrolling effect

Source: Internet
Author: User

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

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.