色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

基于Jquery的文字滾動跑馬燈插件(一個頁面多個滾動區)

兼容各瀏覽器的文本行高
復制代碼 代碼如下:
(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, //卷動速度,數值越大,速度越慢(毫秒
_this.timespan=opt.timespan?parseInt(opt.timespan,13):5000; //滾動的時間間隔(毫秒
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);

調用方法:
line:一次卷動的文本行數
speed:卷動動畫的時間
timespan:間隔時間
復制代碼 代碼如下:
<html>
<body>
<ul id="RunTopic">
<li>文字1</li>
<li>文字2</li>
<li>文字3</li>
<li>文字4</li>
<li>文字5</li>
</ul>
</body>
<script type="text/Javascript">
$(document.body).ready(function(){
$("#RunTopic").RollTitle({line:1,speed:200,timespan:1500});
});
</script>
</html>

JavaScript技術基于Jquery的文字滾動跑馬燈插件(一個頁面多個滾動區),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 迁西县| 台安县| 丹巴县| 建德市| 濉溪县| 彰化县| 宁都县| 潍坊市| 恭城| 德令哈市| 兴城市| 繁昌县| 襄垣县| 疏附县| 会理县| 依安县| 抚宁县| 卫辉市| 育儿| 嘉定区| 英德市| 改则县| 准格尔旗| 台山市| 黄陵县| 大埔区| 交城县| 高清| 玛纳斯县| 西和县| 秭归县| 荥阳市| 合肥市| 西乡县| 泰兴市| 越西县| 宁南县| 华池县| 林甸县| 桦甸市| 兴山县|