复制番号代番号次のように:
/***************滚動场次开始*****************/
function ScrollText(content, btnPrevious, btnNext, autoStart) {
this.Delay = 10;
this.LineHeight = 20;
this.Amount = 1;
this.Direction = "上";
this.タイムアウト = 1500;
this.ScrollContent = this.$(コンテンツ);
this.ScrollContent.innerHTML += this.ScrollContent.innerHTML;
//this.ScrollContent.scrollTop = 0;
if (btnNext) {
this.NextButton = this.$(btnNext);
this.NextButton.onclick = this.GetFunction(this, "次へ");
this.NextButton.onmouseover = this.GetFunction(this, "停止");
this.NextButton.onmouseout = this.GetFunction(this, "開始");
}
if (btnPrevious) {
this.PreviousButton = this.$(btnPrevious);
this.PreviousButton.onclick = this.GetFunction(this, "前");
this.PreviousButton.onmouseover = this.GetFunction(this, "停止");
this.PreviousButton.onmouseout = this.GetFunction(this, "Start");
}
this.ScrollContent.onmouseover = this.GetFunction(this, "停止");
this.ScrollContent.onmouseout = this.GetFunction(this, "Start");
if (自動開始) {
this.Start();
}
}
ScrollText.prototype.$ = 関数 (要素) {
document.getElementById(要素)を返します;
}
ScrollText.prototype.Previous = function () {
clearTimeout(this.AutoScrollTimer);
clearTimeout(this.ScrollTimer);
this.Scroll("上");
}
ScrollText.prototype.Next = function () {
clearTimeout(this.AutoScrollTimer);
clearTimeout(this.ScrollTimer);
this.Scroll("下");
}
ScrollText.prototype.Start = function () {
clearTimeout(this.AutoScrollTimer);
this.AutoScrollTimer = setTimeout(this.GetFunction(this, "AutoScroll"), this.Timeout);
}
ScrollText.prototype.Stop = function () {
clearTimeout(this.ScrollTimer);
clearTimeout(this.AutoScrollTimer);
}
ScrollText.prototype.AutoScroll = function () {
if (this.Direction == "上") {
if (parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2) {
this.ScrollContent.scrollTop = 0;
}
this.ScrollContent.scrollTop += this.Amount;
} それ以外 {
if (parseInt(this.ScrollContent.scrollTop) <= 0) {
this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2;
}
this.ScrollContent.scrollTop -= this.Amount;
}
if (parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0) {
this.ScrollTimer = setTimeout(this.GetFunction(this, "AutoScroll"), this.Delay);
} それ以外 {
this.AutoScrollTimer = setTimeout(this.GetFunction(this, "AutoScroll"), this.Timeout);
}
}
ScrollText.prototype.Scroll = 関数 (方向) {
if (方向 == "上") {
if (this.ScrollContent.scrollTop == 0) {
this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2;
}
this.ScrollContent.scrollTop -= this.Amount;
} それ以外 {
this.ScrollContent.scrollTop += this.Amount;
}
if (parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2) {
this.ScrollContent.scrollTop = 0;
}
if (parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0) {
this.ScrollTimer = setTimeout(this.GetFunction(this, "スクロール", 方向), this.Delay);
}
}
ScrollText.prototype.GetFunction = 関数 (変数、メソッド、パラメータ) {
戻り関数 () {
変数[メソッド](パラメータ);
}
}
if (document.getElementById("ul_round")) {
varscrollup = new ScrollText("ul_round");
スクロールアップ.LineHeight = 40; //一排文字滚動の高さ
スクロールアップ量 = 1; //注意:子模块(LineHeight)一定要能整除量。
スクロールアップ.遅延 = 30; //遅延
スクロールアップ.Start(); //文字自動滚動
スクロールアップ.方向 = "上"; //默认設定は文字向上に設定されています
}
/***************滚動场次结束*****************/