?? scroll.js
字號(hào):
function ScrollArea(instName, areaName, totalCnt, perCnt, dispSize, speed, wait) {
this.instName = instName; // 牢膠畔膠疙
this.areaName = areaName; // 撈悼且 康開 div id
this.totalCnt = parseInt(totalCnt); //喉釩 cnt 啊 酒囪 醚 疇免 單撈磐狼 骯薦;
this.perCnt = parseInt(perCnt); //喉釩寸 單撈磐狼 骯薦;
this.curIndex = 0;
this.destIndex = 0;
this.blockCnt = 0; // 歹固甫 力寇茄 鑒薦 喉釩狼 薦
this.dispSize = parseInt(dispSize); // 喉釩狼 臭撈/承撈
this.speed = parseInt(speed); // 撈悼加檔 : 努薦廢 弧扼嚨
if ( this.speed > this.dispSize ) {
this.speed = this.dispSize;
}
this.autospeed = this.speed ;
this.wait = parseInt(wait); // 喉釩 撈悼 饒 措扁 矯埃 milsec, 0 老 版快 磊悼 膠農(nóng)費(fèi) 竅瘤 臼綽促.
this.funcName = "";
this.objTimeout = 0;
this.firstCall = true;
this.scroll = true;
/* Set blockCnt */
if ( this.totalCnt == 0 || this.perCnt == 0 ) {
this.blockCnt = 0;
} else {
this.blockCnt = this.totalCnt/this.perCnt;
if ( (""+this.blockCnt).indexOf(".") > -1) {
this.blockCnt = parseInt( (""+this.blockCnt).substring(0,(""+this.blockCnt).indexOf(".")) ) + 1;
}
}
this.setBlockCnt = function(blockCnt) {
this.blockCnt = blockCnt;
}
this.getPosition = function(index) {
return -( index * this.dispSize );
}
/* 膠農(nóng)費(fèi) 吝瘤 */
this.scrollStop = function() {
//this.firstCall = true;
//clearTimeout(this.objTimeout);
this.scroll = false;
}
/* 膠農(nóng)費(fèi) 犁俺 */
this.scrollContinue = function() {
//this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", 1);
this.scroll = true;
}
/* 酒貳肺 膠農(nóng)費(fèi) */
this.scrollDown = function() {
this.funcName = "scrollDown";
clearTimeout(this.objTimeout);
if ( this.blockCnt == 0 ) return;
if ( this.firstCall ) {
if ( this.curIndex == this.blockCnt ) {
this.curIndex = 0;
document.getElementById(this.areaName).style.top = this.getPosition( this.curIndex ) ;
}
this.destIndex = this.curIndex + 1;
this.firstCall = false;
}
if ( this.scroll ) {
document.getElementById(this.areaName).style.top = parseInt(document.getElementById(this.areaName).style.top) - this.speed;
}
if ( parseInt( document.getElementById(this.areaName).style.top ) < this.getPosition( this.destIndex ) ) {
document.getElementById(this.areaName).style.top = this.getPosition( this.destIndex ) ;
this.curIndex = this.destIndex;
this.firstCall = true;
if ( parseInt(this.wait) > 0 ) {
this.speed = this.autospeed;
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", this.wait);
}
} else {
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", 1);
}
}
/* 困肺 膠農(nóng)費(fèi) */
this.scrollUp = function() {
this.funcName = "scrollUp";
clearTimeout(this.objTimeout);
if ( this.blockCnt == 0 ) return;
if ( this.firstCall ) {
if ( this.curIndex == 0 ) {
this.curIndex = this.blockCnt;
document.getElementById(this.areaName).style.top = this.getPosition( this.curIndex ) ;
}
this.destIndex = this.curIndex - 1;
this.firstCall = false;
}
if ( this.scroll ) {
document.getElementById(this.areaName).style.top = parseInt(document.getElementById(this.areaName).style.top) + this.speed;
}
if ( parseInt( document.getElementById(this.areaName).style.top ) > this.getPosition( this.destIndex ) ) {
document.getElementById(this.areaName).style.top = this.getPosition( this.destIndex ) ;
this.curIndex = this.destIndex;
this.firstCall = true;
if ( parseInt(this.wait) > 0 ) {
this.speed = this.autospeed;
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", this.wait);
}
} else {
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", 1);
}
}
/* 快螟欄肺 膠農(nóng)費(fèi) */
this.scrollRight = function() {
this.funcName = "scrollRight";
clearTimeout(this.objTimeout);
if ( this.blockCnt == 0 ) return;
if ( this.firstCall ) {
if ( this.curIndex == this.blockCnt ) {
this.curIndex = 0;
document.getElementById(this.areaName).style.left = this.getPosition( this.curIndex ) ;
}
this.destIndex = this.curIndex + 1;
this.firstCall = false;
}
if ( this.scroll ) {
document.getElementById(this.areaName).style.left = parseInt(document.getElementById(this.areaName).style.left) - this.speed;
}
if ( parseInt( document.getElementById(this.areaName).style.left ) < this.getPosition( this.destIndex ) ) {
document.getElementById(this.areaName).style.left = this.getPosition( this.destIndex ) ;
this.curIndex = this.destIndex;
this.firstCall = true;
if ( parseInt(this.wait) > 0 ) {
this.speed = this.autospeed;
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", this.wait);
}
} else {
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", 1);
}
}
/* 諒螟欄肺 膠農(nóng)費(fèi) */
this.scrollLeft = function() {
this.funcName = "scrollLeft";
clearTimeout(this.objTimeout);
if ( this.blockCnt == 0 ) return;
if ( this.firstCall ) {
if ( this.curIndex == 0 ) {
this.curIndex = this.blockCnt;
document.getElementById(this.areaName).style.left = this.getPosition( this.curIndex ) ;
}
this.destIndex = this.curIndex - 1;
this.firstCall = false;
}
if ( this.scroll ) {
document.getElementById(this.areaName).style.left = parseInt(document.getElementById(this.areaName).style.left) + this.speed;
}
if ( parseInt( document.getElementById(this.areaName).style.left ) > this.getPosition( this.destIndex ) ) {
document.getElementById(this.areaName).style.left = this.getPosition( this.destIndex ) ;
this.curIndex = this.destIndex;
this.firstCall = true;
if ( parseInt(this.wait) > 0 ) {
this.speed = this.autospeed;
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", this.wait);
}
} else {
this.objTimeout = setTimeout(this.instName + "." + this.funcName + "()", 1);
}
}
/* 滾瓢 努腐矯 坷配 膠農(nóng)費(fèi)苞 促弗 加檔肺 撈悼 矯懦 版快 */
this.clickDown = function(clickspeed) {
this.speed = parseInt(clickspeed);
this.scrollDown();
}
this.clickUp = function(clickspeed) {
this.speed = parseInt(clickspeed);
this.scrollUp();
}
this.clickLeft = function(clickspeed) {
this.speed = parseInt(clickspeed);
this.scrollLeft();
}
this.clickRight = function(clickspeed) {
this.speed = parseInt(clickspeed);
this.scrollRight();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -