var val = parseInt(val); if (val > 0 ) { this.setAttribute("scrolldelay", val); } this._mutationActor(this._mutationObserver.takeRecords()); return this._direction; this._mutationActor(this._mutationObserver.takeRecords()); return this._behavior; if (typeof val == 'string') { val = val.toLowerCase(); } if (val == "alternate" || val == "slide" || val == 'scroll') { this.setAttribute("behavior", val); } 0) { this.setAttribute("loop", val); } ]]> return this.getAttribute("onstart"); this._setEventListener("start", val, true); this.setAttribute("onstart", val); return this.getAttribute("onfinish"); this._setEventListener("finish", val, true); this.setAttribute("onfinish", val); return this.getAttribute("onbounce"); this._setEventListener("bounce", val, true); this.setAttribute("onbounce", val); this.outerDiv.offsetHeight) { corrvalue = this.originalHeight - this.outerDiv.offsetHeight; } this.innerDiv.style.padding = height + " 0"; this.dirsign = 1; this.startAt = (this._behavior == 'alternate') ? (this.originalHeight - corrvalue) : 0; this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height)); break; case "down": var height = document.defaultView.getComputedStyle(this).height; this.outerDiv.style.height = height; if (this.originalHeight > this.outerDiv.offsetHeight) { corrvalue = this.originalHeight - this.outerDiv.offsetHeight; } this.innerDiv.style.padding = height + " 0"; this.dirsign = -1; this.startAt = (this._behavior == 'alternate') ? (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height)); this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? (this.originalHeight - corrvalue) : 0; break; case "right": if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth) { corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth; } this.dirsign = -1; this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ? (this.innerDiv.offsetWidth - corrvalue) : 0; this.startAt = this.outerDiv.offsetWidth + ((this._behavior == 'alternate') ? corrvalue : (this.innerDiv.offsetWidth + this.stopAt)); break; case "left": default: if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth) { corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth; } this.dirsign = 1; this.startAt = (this._behavior == 'alternate') ? (this.innerDiv.offsetWidth - corrvalue) : 0; this.stopAt = this.outerDiv.offsetWidth + ((this._behavior == 'alternate' || this._behavior == 'slide') ? corrvalue : (this.innerDiv.offsetWidth + this.startAt)); } if (aResetPosition) { this.newPosition = this.startAt; this._fireEvent("start", false, false); } } //end if this.newPosition = this.newPosition + (this.dirsign * this._scrollAmount); if ((this.dirsign == 1 && this.newPosition > this.stopAt) || (this.dirsign == -1 && this.newPosition < this.stopAt)) { switch (this._behavior) { case 'alternate': // lets start afresh this.startNewDirection = true; // swap direction const swap = {left: "right", down: "up", up: "down", right: "left"}; this._direction = swap[this._direction]; this.newPosition = this.stopAt; if ((this._direction == "up") || (this._direction == "down")) { this.outerDiv.scrollTop = this.newPosition; } else { this.outerDiv.scrollLeft = this.newPosition; } if (this._loop != 1) { this._fireEvent("bounce", false, true); } break; case 'slide': if (this._loop > 1) { this.newPosition = this.startAt; } break; default: this.newPosition = this.startAt; if ((this._direction == "up") || (this._direction == "down")) { this.outerDiv.scrollTop = this.newPosition; } else { this.outerDiv.scrollLeft = this.newPosition; } //dispatch start event, even when this._loop == 1, comp. with IE6 this._fireEvent("start", false, false); } if (this._loop > 1) { this._loop--; } else if (this._loop == 1) { if ((this._direction == "up") || (this._direction == "down")) { this.outerDiv.scrollTop = this.stopAt; } else { this.outerDiv.scrollLeft = this.stopAt; } this.stop(); this._fireEvent("finish", false, true); return; } } else { if ((this._direction == "up") || (this._direction == "down")) { this.outerDiv.scrollTop = this.newPosition; } else { this.outerDiv.scrollLeft = this.newPosition; } } var myThis = this; var lambda = function myTimeOutFunction(){myThis._doMove(false);} this.runId = window.setTimeout(lambda, this._scrollDelay); ]]> 0) { var mutation = aMutations.shift(); var attrName = mutation.attributeName.toLowerCase(); var oldValue = mutation.oldValue; var target = mutation.target; var newValue = target.getAttribute(attrName); if (oldValue != newValue) { switch (attrName) { case "loop": target._set_loop(newValue); if (target.rundId == 0) { target.start(); } break; case "scrollamount": target._set_scrollAmount(newValue); break; case "scrolldelay": target._set_scrollDelay(newValue); target.stop(); target.start(); break; case "truespeed": //needed to update target._scrollDelay var myThis = target; var lambda = function() {myThis._set_scrollDelay(myThis.getAttribute('scrolldelay'));} window.setTimeout(lambda, 0); break; case "behavior": target._set_behavior(newValue); target.startNewDirection = true; if ((oldValue == "slide" && target.newPosition == target.stopAt) || newValue == "alternate" || newValue == "slide") { target.stop(); target._doMove(true); } break; case "direction": if (!newValue) { newValue = "left"; } target._set_direction(newValue); break; case "width": case "height": target.startNewDirection = true; break; case "onstart": target._setEventListener("start", newValue); break; case "onfinish": target._setEventListener("finish", newValue); break; case "onbounce": target._setEventListener("bounce", newValue); break; } } } ]]>