Timeline for The efficiency and options of my PNG sequence JS class
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 17, 2012 at 8:37 | vote | accept | Dave Mackintosh | ||
Aug 15, 2012 at 16:19 | comment | added | Alnitak | oops, that's not quite right. | |
Aug 15, 2012 at 14:48 | comment | added | Alnitak |
I mean that the last block just needs to say if (self.looping && self.index > self.NSlides) { index = 0; } and then just call self.interGo . There's no need for a clearTimeout . See jsfiddle.net/alnitak/mVF75
|
|
Aug 15, 2012 at 14:42 | comment | added | Dave Mackintosh | I've updated the gist again, I didn't quite understand what you meant by "merge together the question of resetting the index or firing again" | |
Aug 15, 2012 at 14:10 | comment | added | Alnitak |
In your new code I'd move the var self = this just inside the interGo function. It'll stop the interpreter from trying to build the closure around the whole function instead of just the inner function. Also, move your end-of-loop test to the end of the function, where you can merge together the question of resetting the index or firing again.
|
|
Aug 15, 2012 at 14:04 | comment | added | Dave Mackintosh | Thanks man! Only took 30 minutes to build, hadn't noticed I was using self. instead of this. in the functions IN scope lol. I've updated the gist :) gist.github.com/3360011 | |
Aug 15, 2012 at 13:54 | history | answered | Alnitak | CC BY-SA 3.0 |