分享一款文字定时向上滚动js特效,当用户的鼠标经过时暂停滚动,自定义滚动速度,这个文字滚动特效兼容当前主流浏览器。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>仿DZ论坛js文字定时向上滚动特效_武鸣人</title> <style type="text/css"> .wwwwumingren{border:1px solid #eee;width:668px;font-size:12px;height:24px;overflow:hidden;} .wwwwumingren ul{list-style-type:none;margin:0;padding:0;margin-left:32px;} .wwwwumingren ul li{height:26px;line-height:26px;width:320px;float:left;display:inline;} </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="wuming_1" class="wwwwumingren"> <ul> <li><a href="https://www.wuming.ren" target="_blank">武鸣人一号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人二号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人三号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人四号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人五号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人六号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人七号滚动新闻</a></li><li><a href="https://www.wuming.ren" target="_blank">武鸣人八号滚动新闻/a></li> </ul> </div> <script type="text/javascript"> function $(element){ if(arguments.length>1){ for(var i=0,length=arguments.length,elements=[];i<length;i++){ elements.push($(arguments[i])); } return elements; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if(typeof element=="string"){ return document.getElementById(element); }else{ return element; } } var Class={ create:function(){ return function(){ this.initialize.apply(this,arguments); } } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) Function.prototype.bind=function(object){ var method=this; return function(){ method.apply(object,arguments); } } var Scroll=Class.create(); Scroll.prototype={ initialize:function(element,height){ this.element=$(element); this.element.innerHTML+=this.element.innerHTML; this.height=height; this.maxHeight=this.element.scrollHeight/2; this.counter=0; this.scroll(); this.timer=""; this.element.onmouseover=this.stop.bind(this); this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this); }, scroll:function(){ if(this.element.scrollTop<this.maxHeight){ this.element.scrollTop++; this.counter++; }else{ this.element.scrollTop=0; this.counter=0; } //武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) if(this.counter<this.height){ this.timer=setTimeout(this.scroll.bind(this),22); }else{ this.counter=0; this.timer=setTimeout(this.scroll.bind(this),3126); } }, stop:function(){ clearTimeout(this.timer); } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var myscroll=new Scroll("wuming_1",26); </script> </body> </html>
本文来自武鸣人网站,转载请注明出处