| Код | function Scroll_moveForvard() { if (count < scrollValue) { speed = (scrollValue - count) / this.kStop + 1; this.position = this.position - speed; object.style.left = this.position + 'px'; count = count + speed; } else { clearInterval(this.timer); this.timer = 0; } }
function Scroll_initMoveForvard() { if (this.timer == 0) { if (this.visibleElement < this.elementCount) { scrollValue = this.scrollWidth; this.visibleElement = this.visibleElement + 1; count = 0;
object = parentdoc.getElementById(this.scrollBlock); this.timer = setInterval(this.moveForvard(), this.timeOut); } } }
var object; var count = 0; var scrollValue; var parentdoc;
function Scroll(doc, scrollBlock, elementCount, width) { parentdoc = doc; this.scrollBlock = scrollBlock; this.position = 0; this.scrollWidth = width; this.timer = 0; this.kStop = 2.5; this.timeOut = 50;
this.elementCount = elementCount; this.visibleElement = 1; this.moveBack = Scroll_moveBack; this.moveForvard = Scroll_moveForvard; this.initMoveBack = Scroll_initMoveBack; this.initMoveForvard = Scroll_initMoveForvard; /* this.initMoveTo = Scroll_initMoveTo; this.controlBackHover = Scroll_controlBackHover; this.controlBackOut = Scroll_controlBackOut; this.controlForvardHover = Scroll_controllForvardHover; this.controlForvardOut = Scroll_controlForvardOut;*/ }
|
Так вот по initMoveForvard функция запускается один раз хотя там стоит setInterval все условия внутри метода выполняются ... |