最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

javascript上下左右定時(shí)滾動(dòng)插件

 更新時(shí)間:2010年06月19日 16:43:52   作者:  
在網(wǎng)上找到的,我認(rèn)為最為方便的一段定時(shí)滾動(dòng)代碼,找了很多其他的總是有這樣那樣的問題,好不容易找到的,就分享一下。
核心代碼:
復(fù)制代碼 代碼如下:

<script type="text/javascript">
function Marquee() {
this.ID = document.getElementById(arguments[0]);
this.Direction = arguments[1];
this.Step = arguments[2];
this.Width = arguments[3];
this.Height = arguments[4];
this.Timer = arguments[5];
this.WaitTime = arguments[6];
this.StopTime = arguments[7];
if (arguments[8]) { this.ScrollStep = arguments[8]; } else { this.ScrollStep = this.Direction > 1 ? this.Width : this.Height; }
this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
this.ID.noWrap = true;
this.ID.style.width = this.Width;
this.ID.style.height = this.Height;
this.ClientScroll = this.Direction > 1 ? this.ID.scrollWidth : this.ID.scrollHeight;
this.ID.innerHTML += this.ID.innerHTML;
this.Start(this, this.Timer, this.WaitTime, this.StopTime);
}
Marquee.prototype.Start = function(msobj, timer, waittime, stoptime) {
msobj.StartID = function() { msobj.Scroll(); }
msobj.Continue = function() {
if (msobj.MouseOver == 1) { setTimeout(msobj.Continue, waittime); }
else { clearInterval(msobj.TimerID); msobj.CTL = msobj.Stop = 0; msobj.TimerID = setInterval(msobj.StartID, timer); }
}
msobj.Pause = function() { msobj.Stop = 1; clearInterval(msobj.TimerID); setTimeout(msobj.Continue, waittime); }
msobj.Begin = function() {
msobj.TimerID = setInterval(msobj.StartID, timer);
msobj.ID.onmouseover = function() { msobj.MouseOver = 1; clearInterval(msobj.TimerID); }
msobj.ID.onmouseout = function() { msobj.MouseOver = 0; if (msobj.Stop == 0) { clearInterval(msobj.TimerID); msobj.TimerID = setInterval(msobj.StartID, timer); } }
}
setTimeout(msobj.Begin, stoptime);
}
Marquee.prototype.Scroll = function() {
switch (this.Direction) {
case 0:
this.CTL += this.Step;
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; }
else { if (this.ID.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.WaitTime > 0) { this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; }
else { if (this.ID.scrollTop <= 0) this.ID.scrollTop += this.ClientScroll; this.ID.scrollTop -= this.Step; }
break;
case 2:
this.CTL += this.Step;
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; }
else { if (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.WaitTime > 0) { this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; }
else { if (this.ID.scrollLeft <= 0) this.ID.scrollLeft += this.ClientScroll; this.ID.scrollLeft -= this.Step; }
break;
}
}
</script>

控制使用代碼:
復(fù)制代碼 代碼如下:

<script type="text/javascript">
<!--
window.onload = function() {
new Marquee(
"s1", //容器ID
0, //向上滾動(dòng)(0向上 1向下 2向左 3向右)
2, //滾動(dòng)的步長
251, //容器可視寬度
520, //容器可視高度
50, //定時(shí)器 數(shù)值越小,滾動(dòng)的速度越快(1000=1秒,建議不小于20)
2000, //間歇停頓時(shí)間(0為不停頓,1000=1秒)
3000, //開始時(shí)的等待時(shí)間(0為不等待,1000=1秒)
75 //間歇滾動(dòng)間距(可選),可理解為行高,我這里是3*25=75,就是每次滾動(dòng)三行
);
};
-->
</script>

效果演示:

[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]

相關(guān)文章

  • 仿打字特效的JS逐字出現(xiàn)的信息文字

    仿打字特效的JS逐字出現(xiàn)的信息文字

    JavaScript編寫的文字特效,看似打字的效果,讓文字逐個(gè)出現(xiàn),你可以以這個(gè)為基礎(chǔ)給你心愛的人寫一段祝福的語,這的確挺合適。
    2009-10-10
  • 讓鏈接必須按先后順序點(diǎn)擊的JS代碼

    讓鏈接必須按先后順序點(diǎn)擊的JS代碼

    讓鏈接必須按先后順序點(diǎn)擊的JS代碼,用到廣告上面比較好,有不少的文字或圖片廣告有類似效果,點(diǎn)鏈接的時(shí)候需要按順序,請注意鏈接地址,寫在JS代碼里的是真正需要的地址。
    2009-10-10
  • javascript 網(wǎng)頁上跳動(dòng)的文字

    javascript 網(wǎng)頁上跳動(dòng)的文字

    網(wǎng)頁上跳動(dòng)的文字,代碼稍復(fù)雜,效果挺可愛的,一跳一跳的文字,真逗人!
    2009-10-10
  • 最新評論

    阿合奇县| 扎囊县| 肇源县| 金昌市| 中超| 乌鲁木齐市| 罗江县| 开封县| 瓦房店市| 辽阳市| 望都县| 含山县| 定州市| 中宁县| 宁晋县| 潜江市| 吴川市| 汉源县| 固原市| 阜新| 临西县| 含山县| 监利县| 大足县| 神木县| 沐川县| 夏邑县| 政和县| 绩溪县| 崇信县| 连州市| 宣城市| 唐海县| 兴业县| 灌南县| 晴隆县| 象山县| 布拖县| 司法| 夏津县| 六盘水市|