Saturday, 10 August 2013

understanding setTimeout()

understanding setTimeout()

I'm trying to make jcarousel work both sides
If I use the following it returns the correct alert
this.timer = window.setTimeout( (a === 0.5)? alert("c.next() a = " + a):
(a === 0.6)? alert("c.prev() a = " + a):
function(){},500 ) ;
but, if I replace the alert with the actual call it doesn't scroll. just
moves to the next image
this.timer = window.setTimeout( (a === 0.5)? c.next.bind(c):
(a === 0.6)? c.prev.bind(c):
function(){},500 ) ;
without bind() it doesn't work either
this.timer = window.setTimeout( (a === 0.5)? c.next():
(a === 0.6)? c.prev(): function(){},500 ) ;
Does anyone has an idea why is this happening? if I don't use any
condition inside Timeout and use one of the two calls, for example
c.next() then it would scroll but only from Right to Left
Any guideline will be greatly appreciated Sandra

No comments:

Post a Comment