michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this.setAttribute("scrollamount", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this.setAttribute("scrolldelay", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: return this.getAttribute("direction"); michael@0: michael@0: michael@0: this.setAttribute("direction", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: return this._behavior; michael@0: michael@0: michael@0: this.setAttribute("behavior", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this.setAttribute("loop", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: return this.getAttribute("onstart"); michael@0: michael@0: michael@0: this._setEventListener("start", val, true); michael@0: this.setAttribute("onstart", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: return this.getAttribute("onfinish"); michael@0: michael@0: michael@0: this._setEventListener("finish", val, true); michael@0: this.setAttribute("onfinish", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: return this.getAttribute("onbounce"); michael@0: michael@0: michael@0: this._setEventListener("bounce", val, true); michael@0: this.setAttribute("onbounce", val); michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this.outerDiv.offsetHeight) michael@0: corrvalue = this.originalHeight - this.outerDiv.offsetHeight; michael@0: this.innerDiv.style.padding = height + " 0"; michael@0: this.dirsign = 1; michael@0: this.startAt = (this._behavior == 'alternate') ? (this.originalHeight - corrvalue) : 0; michael@0: this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? michael@0: (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height)); michael@0: break; michael@0: michael@0: case "down": michael@0: var height = document.defaultView.getComputedStyle(this, "").height; michael@0: this.outerDiv.style.height = height; michael@0: if (this.originalHeight > this.outerDiv.offsetHeight) michael@0: corrvalue = this.originalHeight - this.outerDiv.offsetHeight; michael@0: this.innerDiv.style.padding = height + " 0"; michael@0: this.dirsign = -1; michael@0: this.startAt = (this._behavior == 'alternate') ? michael@0: (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height)); michael@0: this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? michael@0: (this.originalHeight - corrvalue) : 0; michael@0: break; michael@0: michael@0: case "right": michael@0: if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth) michael@0: corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth; michael@0: this.dirsign = -1; michael@0: this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? michael@0: (this.innerDiv.offsetWidth - corrvalue) : 0; michael@0: this.startAt = this.outerDiv.offsetWidth + ((this._behavior == 'alternate') ? michael@0: corrvalue : (this.innerDiv.offsetWidth + this.stopAt)); michael@0: break; michael@0: michael@0: case "left": michael@0: default: michael@0: if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth) michael@0: corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth; michael@0: this.dirsign = 1; michael@0: this.startAt = (this._behavior == 'alternate') ? (this.innerDiv.offsetWidth - corrvalue) : 0; michael@0: this.stopAt = this.outerDiv.offsetWidth + michael@0: ((this._behavior == 'alternate' || this._behavior == 'slide') ? michael@0: corrvalue : (this.innerDiv.offsetWidth + this.startAt)); michael@0: } michael@0: michael@0: if (aResetPosition) { michael@0: this.newPosition = this.startAt; michael@0: this._fireEvent("start", false, false); michael@0: } michael@0: } //end if michael@0: michael@0: this.newPosition = this.newPosition + (this.dirsign * this._scrollAmount); michael@0: michael@0: if ((this.dirsign == 1 && this.newPosition > this.stopAt) || michael@0: (this.dirsign == -1 && this.newPosition < this.stopAt)) michael@0: { michael@0: switch (this._behavior) michael@0: { michael@0: case 'alternate': michael@0: // lets start afresh michael@0: this.startNewDirection = true; michael@0: michael@0: // swap direction michael@0: const swap = {left: "right", down: "up", up: "down", right: "left"}; michael@0: this._direction = swap[this._direction]; michael@0: this.newPosition = this.stopAt; michael@0: michael@0: if ((this._direction == "up") || (this._direction == "down")) michael@0: this.outerDiv.scrollTop = this.newPosition; michael@0: else michael@0: this.outerDiv.scrollLeft = this.newPosition; michael@0: michael@0: if (this._loop != 1) michael@0: this._fireEvent("bounce", false, true); michael@0: break; michael@0: michael@0: case 'slide': michael@0: if (this._loop > 1) michael@0: this.newPosition = this.startAt; michael@0: break; michael@0: michael@0: default: michael@0: this.newPosition = this.startAt; michael@0: michael@0: if ((this._direction == "up") || (this._direction == "down")) michael@0: this.outerDiv.scrollTop = this.newPosition; michael@0: else michael@0: this.outerDiv.scrollLeft = this.newPosition; michael@0: michael@0: //dispatch start event, even when this._loop == 1, comp. with IE6 michael@0: this._fireEvent("start", false, false); michael@0: } michael@0: michael@0: if (this._loop > 1) michael@0: this._loop--; michael@0: else if (this._loop == 1) { michael@0: if ((this._direction == "up") || (this._direction == "down")) michael@0: this.outerDiv.scrollTop = this.stopAt; michael@0: else michael@0: this.outerDiv.scrollLeft = this.stopAt; michael@0: this.stop(); michael@0: this._fireEvent("finish", false, true); michael@0: return; michael@0: } michael@0: } michael@0: else { michael@0: if ((this._direction == "up") || (this._direction == "down")) michael@0: this.outerDiv.scrollTop = this.newPosition; michael@0: else michael@0: this.outerDiv.scrollLeft = this.newPosition; michael@0: } michael@0: michael@0: var myThis = this; michael@0: var lambda = function myTimeOutFunction(){myThis._doMove(false);} michael@0: this.runId = window.setTimeout(lambda, this._scrollDelay); michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: