Home > Web Front-end > JS Tutorial > Text scrolling marquee plug-in based on Jquery (multiple scrolling areas on one page)_jquery

Text scrolling marquee plug-in based on Jquery (multiple scrolling areas on one page)_jquery

WBOY
Release: 2016-05-16 18:22:28
Original
1331 people have browsed it

Compatible with the text line height of each browser

Copy the code The code is as follows:

(function($ ){
$.fn.extend({
RollTitle: function(opt,callback){
if(!opt) var opt={};
var _this = this;
_this .timer = null;
_this.lineH = _this.find("li:first").height();
_this.line=opt.line?parseInt(opt.line,15):parseInt(_this .height()/_this.lineH,10);
_this.speed=opt.speed?parseInt(opt.speed,10):3000, //Scroll speed, the larger the value, the slower the speed (milliseconds
_this.timespan=opt.timespan?parseInt(opt.timespan,13):5000; //Scrolling time interval (milliseconds
if(_this.line==0) this.line=1;
_this.upHeight=0-_this.line*_this.lineH;
_this.scrollUp=function(){
_this.animate({
marginTop:_this.upHeight
},_this.speed, function(){
for(i=1;i<=_this.line;i ){
_this.find("li:first").appendTo(_this);
}
_this .css({marginTop:0});
});
}
_this.hover(function(){
clearInterval(_this.timer);
},function(){
_this.timer=setInterval(function(){_this.scrollUp();},_this.timespan);
}).mouseout();
}
})
}) (jQuery);

Calling method:
line: number of text lines scrolled at one time
speed: scroll animation time
timespan: interval time
Copy code The code is as follows:




  • Text 1

  • Text 2

  • Text 3

  • < ;li>Text 4
  • Text 5





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template