您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 基于Jquery的文字滚动效果大全
基于Jquery的文字滚动跑马灯插件(一个页面多个滚动区)兼容各浏览器的文本行高复制代码代码如下:(function($){$.fn.extend({RollTitle:function(opt,callback){if(!opt)varopt={};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:间隔时间复制代码代码如下:htmlbodyulid=RunTopicli文字1/lili文字2/lili文字3/lili文字4/lili文字5/li/ul/bodyscripttype=text/javascript$(document.body).ready(function(){$(#RunTopic).RollTitle({line:1,speed:200,timespan:1500});});/script/html详细出处参考:文字轮流滚动,jquery帮忙文字轮流滚动,jquery帮忙,走走停停,一次滚动一行,类似会停顿的走马灯,但又不完全是,代码里使用了克隆,不用克隆的话,remove()就没了。title文字轮流滚动,jquery帮忙/titlescriptlanguage=javascripttype=text/javascriptsrc=/ajaxjs/jquery1.3.2.js/scriptscriptfunctionscroll_news(){$(function(){$('#dvmqli').eq(0).fadeOut('slow',function(){//alert($(this).clone().html());//克隆:不用克隆的话,remove()就没了。$(this).clone().appendTo($(this).parent()).fadeIn('slow');$(this).remove();});});}setInterval('scroll_news()',1000);/scriptdivid=dvmqstyle=width:363px;height:32px;ulli1,one/lili2,two/lili3,three/lili4,我走一步,停一停!/li/ul/divJS一行多列文字循环滚动带停顿这个代码很有用哦,可以自动把一个LI列表分为一行三列循环不间断滚动,中间有时间间隔,也就是停顿,有不少网站都在用这款代码哦,这就是从网上直接扒下来的,确实很不错。!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//EN=多列文字循环滚动/TITLEMETAhttp-equiv=Content-Typecontent=text/html;charset=gbkstyletype=text/cssul{padding-right:0px;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px}#announcement{width:100%;overflow:hidden;}#announcementdiv{border:#e6e6e61pxsolid;padding:0px10px0px10px;overflow-y:hidden;line-height:24px;height:24px}#announcementli{font-size:12px;float:left;list-style-type:none;margin-right:20px;padding-left:10px;white-space:nowrap}#announcementa{text-decoration:none;}#announcementa:hover{text-decoration:underline;}/style/HEADBODYDIVid=announcementonMouseOver=if(!anncount){clearTimeout(annst);annst=0}onMouseOut=if(!annst)annst=setTimeout('announcementScroll()',anndelay);DIVid=announcementbodyULliahref=/soft/4596.shtmltarget=_blankjQuery类似腾讯网的图片幻灯特效(可自动播放)/a/liliahref=/soft/4591.shtmltarget=_blankVB版增强型Windows任务管理器/a/liliahref=/soft/4589.shtmltarget=_blankJQueryTip多风格链接提示框/a/liliahref=/soft/4584.shtmltarget=_blankVC++动态加载、调用smtp.dll发邮件示例/a/liliahref=/soft/4583.shtmltarget=_blankVC++连连看游戏源码附外挂/a/liliahref=/soft/4579.shtmltarget=_blank基于API的VBHOOK钩子拦截程序/a/liliahref=/soft/4577.shtmltarget=_blankVB操作系统的一些常用小技巧集/a/liliahref=/soft/4563.shtmltarget=_blankxTree标准的WEB菜单树(树形菜单)/a/li/UL/DIV/DIVscripttype=text/javascriptfunction$(id){returndocument.getElementById(id);}varanndelay=3000;varanncount=0;varannheight=24;varannst=0;functionannouncementScroll(){if(!annst){$('announcementbody').innerHTML+='brstyle=clear:both/'+$('announcementbody').innerHTML;$('announcementbody').scrollTop=0;if($('announcementbody').scrollHeightannheight*3){annst=setTimeout('announcementScroll()',anndelay);}else{$('announcement').onmouseover=$('announcement').onmouseout=null;}return;}if(anncount==annheight){if($('announcementbody').scrollHeight-annheight=$('announcementbody').scrollTop){$('announcementbody').scrollTop=$('announcementbody').scrollHeight/2-annheight;}anncount=0;annst=setTimeout('announcementScroll()',anndelay);}else{$('announcementbody').scrollTop++;anncount++;annst=setTimeout('announcementScroll()',10);}}announcementScroll();/script/BODY/HTML网站公告Js滚动代码一段文字的滚动效果,常见于网站公告,鼠标放上停止滚动。htmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=gb2312title网站公告滚动/title/headbodymarqueestyle=color:#414141;font-size:12px;line-height:17px;direction=upheight=90scrollamount=1scrolldelay=100onMouseOver=this.scrollDelay=500onMouseOut=this.scrollDelay=1width=100Tomat6.0的配置视频教程,AVI电影格式,相当清淅了,比起图文版的教程更贴切,不会配置Tomcat的网友,你可不要错过哦,由于视频抓图挺麻烦的,试了多次还是抓了一个不太清淅的,大家将就吧。/td/marquee/body/html很牛的字幕滚动效果很牛的字幕滚动特效,类似TAB选项卡一样,如果选项卡内的内容超过边界,可以点击下边的向上或向下按钮,控件文字上下滚动,黑色的界面看上去更酷了一些。htmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=gb2312title很牛的滚动字幕效果/title/headbodyonload=init()SCRIPTlanguage=JavaScriptfunctionDynLayer(id,nestref,frame){if(!is.ns5&&!DynLayer.set&&!frame)DynLayerInit()this.frame=frame||selfif(is.ns){if(is.ns4){if(!f
本文标题:基于Jquery的文字滚动效果大全
链接地址:https://www.777doc.com/doc-3606857 .html