4个方向的无间歇滚动和间歇滚动

上传人:平*** 文档编号:16842912 上传时间:2017-11-09 格式:DOC 页数:8 大小:58.49KB
返回 下载 相关 举报
4个方向的无间歇滚动和间歇滚动_第1页
第1页 / 共8页
4个方向的无间歇滚动和间歇滚动_第2页
第2页 / 共8页
4个方向的无间歇滚动和间歇滚动_第3页
第3页 / 共8页
4个方向的无间歇滚动和间歇滚动_第4页
第4页 / 共8页
4个方向的无间歇滚动和间歇滚动_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《4个方向的无间歇滚动和间歇滚动》由会员分享,可在线阅读,更多相关《4个方向的无间歇滚动和间歇滚动(8页珍藏版)》请在金锄头文库上搜索。

1、4 个方向的无间歇滚动和间歇滚动与之间a,body,selectfont-size:12px;text-decoration:none;/* 通用不间断滚动 JS 封装类* 深蓝蝴蝶* 使用方法* new Marquee(marquee,0,1,760,52,50,5000,3000)* new Marquee(marquee,0,1,760,104,50,5000,3000,52)* 参数说明:* 参数 1 marquee 容器 ID* 参数 2 0 向上滚动(0-向上 1-向下 2-向左 3-向右)* 参数 3 1 滚动的步长(数值越大,滚动越快)* 参数 4 760 容器可视宽度* 参数

2、 5 52 容器可视高度* 参数 6 50 定时器(数值越小,滚动的速度越快 1000=1 秒,建议不小于20)* 参数 7 5000 间歇停顿延迟时间(0 为不停顿,1000=1 秒)* 参数 8 3000 开始时的等待时间(0 为不等待,1000=1 秒)* 参数 9 (52) 间歇滚动间距(可选,该数值与延迟均为 0 则为鼠标悬停控制)* 使用建议:* 1、建议直接赋予容器的显示区域的宽度和高度,* 如(.)* 2、建议为容器添加样式 overflow=auto,* 如(.)* 3、为了更准确的获取滚动区域的宽度和高度,请尽可能将各滚动单位直接赋予正确宽高度* 4、对于 TABLE 标记

3、的横向滚动,需要对 TABLE 添加样式 display=inline,* 如(.)* 5、对于翻屏滚动或间歇滚动,要注意各滚动单位间的间距,* 同时需要对容器的可视高度和可视宽度做好准确的设置,对于各滚动单位间的间距可以通过设置行间距或者单元格的高宽度来进行调整* 6、对于 LI 自动换行的问题暂时没有更好的解决办法,建议将其转换成表格(TABLE)的形式来达到同等的效果* 注意:仅用 div 的时候需要用 来包括 div*/var Marquee=function()this.ID=document.getElementById(arguments0);this.Direction=arg

4、uments1;this.Step=arguments2;this.BakStep=arguments2;this.Width=arguments3;this.HalfWidth=Math.round(arguments3/2);this.Height=arguments4;this.Timer=arguments5;this.DelayTime=arguments6;this.WaitTime=arguments7;if(arguments8 | arguments8=0)this.ScrollStep=arguments8;elsethis.ScrollStep=this.Directio

5、n1?this.Width:this.Height;this.Correct=0;this.CTL=0;this.StartID=0;this.Stop=0;this.MouseOver=0;this.ID.style.overflow=hidden;this.ID.style.overflowX=hidden;this.ID.style.overflowY=hidden;this.ID.noWrap=true;this.ID.style.width=this.Width+px;this.ID.style.height=this.Height+px;this.ClientScroll=this

6、.Direction1?parseInt(this.ID.scrollWidth):parseInt(this.ID.scrollHeight);this.ID.innerHTML+=this.ID.innerHTML;this.IsNotOpera=(navigator.userAgent.toLowerCase().indexOf(opera)=-1);if(arguments.length=8)this.Start(this,this.Timer,this.DelayTime,this.WaitTime);Marquee.prototype.Start=function(msobj,ti

7、mer,delaytime,waittime)msobj.StartID=function()msobj.Scroll();msobj.Continue=function()if(msobj.MouseOver=1)setTimeout(msobj.Continue,delaytime);elseclearInterval(msobj.TimerID);msobj.CTL=0;msobj.Stop=0;msobj.TimerID=setInterval(msobj.StartID,timer);msobj.Pause=function()msobj.Stop=1;clearInterval(m

8、sobj.TimerID);setTimeout(msobj.Continue,delaytime);msobj.Begin=function()msobj.ID.onmousemove=function(evt)if(msobj.ScrollStep=0 & msobj.Direction1)var event=null;if(window.event)event=window.event;if(msobj.IsNotOpera)msobj.EventLeft=event.srcElement.id=msobj.ID.id?parseInt(event.offsetX)-parseInt(m

9、sobj.ID.scrollLeft):parseInt(event.srcElement.offsetLeft)-parseInt(msobj.ID.scrollLeft)+parseInt(event.offsetX);elsemsobj.ScrollStep=null;return;elseevent=evt;msobj.EventLeft=parseInt(event.layerX)-parseInt(msobj.ID.scrollLeft);msobj.Direction=msobj.EventLeftmsobj.HalfWidth?3:2;msobj.AbsCenter=Math.

10、abs(msobj.HalfWidth-msobj.EventLeft);msobj.Step=Math.round(msobj.AbsCenter*(msobj.BakStep*2)/msobj.HalfWidth);msobj.ID.onmouseover=function()if(msobj.ScrollStep=0)return;msobj.MouseOver=1;clearInterval(msobj.TimerID);msobj.ID.onmouseout=function()if(msobj.ScrollStep=0)if(msobj.Step=0)msobj.Step=1;re

11、turn;msobj.MouseOver=0;if(msobj.Stop=0)clearInterval(msobj.TimerID);msobj.TimerID=setInterval(msobj.StartID,timer);msobj.TimerID=setInterval(msobj.StartID,timer);setTimeout(msobj.Begin,waittime);Marquee.prototype.Scroll=function()if(this.Correct=0 & this.CTLthis.ClientScroll)this.ClientScroll=(this.

12、Direction1)?Math.round(parseInt(this.ID.scrollWidth)/2):Math.round(parseInt(this.ID.scrollHeight)/2);this.Correct=1;switch(this.Direction)case 0:this.CTL+=this.Step;if(this.CTL=this.ScrollStep & this.DelayTime0)this.ID.scrollTop+=(this.ScrollStep+this.Step-this.CTL);this.Pause();return;elseif(this.I

13、D.scrollTop=this.ClientScroll)this.ID.scrollTop-=this.ClientScroll;this.ID.scrollTop+=this.Step;break;case 1:this.CTL+=this.Step;if(this.CTL=this.ScrollStep & this.DelayTime0)this.ID.scrollTop-=(this.ScrollStep+this.Step-this.CTL);this.Pause();return;elseif(this.ID.scrollTop=this.ScrollStep & this.D

14、elayTime0)this.ID.scrollLeft+=(this.ScrollStep+this.Step-this.CTL);this.Pause();return;elseif(this.ID.scrollLeft=this.ClientScroll)this.ID.scrollLeft-=this.ClientScroll;this.ID.scrollLeft+=this.Step;break;case 3:this.CTL+=this.Step;if(this.CTL=this.ScrollStep & this.DelayTime0)this.ID.scrollLeft-=(t

15、his.ScrollStep+this.Step-this.CTL);this.Pause();return;elseif(this.ID.scrollLeft与 之间仅用 div 的时候需要用来包括 div不间断滚动实例鼠标悬停控制,左移鼠标,向左移动;反之亦然。文字翻屏滚动需要文字内容高度大于 div 定义的高度,如果小了,则无法移动。隐形的翅膀每一次都在徘徊孤单中坚强每一次就算很受伤也不闪泪光我知道我一直有双隐形的翅膀带我飞飞过绝望不去想他们拥有美丽的太阳我看见 每天的夕阳 也会有变化我知道我一直有双隐形的翅膀带我飞给我希望我终于 看到所有梦想都开花追逐的年轻歌声多嘹亮我终于翱翔用心凝望不害怕哪里会有风就飞多远吧隐形的翅膀让梦恒久比天长留一个愿望让自己想象文字间歇滚动需要文字内容高度大于 div 定义的高度,如果小了,则无法移动。隐形的翅膀 每一次都在徘徊孤单中坚强向上翻屏滚动向下翻屏滚动向左翻屏滚动向右翻屏滚动向上连续滚动向左连续滚动向上间歇滚动向左间歇滚动trynew Marquee(ma

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号