drgrep
06-08-2007, 10:39 PM
1) Script Title: Ultimate Fade-in slideshow (v1.5)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
3) Describe problem:
I have read through the code and all of it makes sense, except I am stuck on one part. Could someone please explain the logic behind the cacheobj in fadeshow.prototype.rotateimage:
// If pause onMouseover enabled, cache object
if(this.pausecheck == 1)
{
var cacheobj = this;
}
if(this.mouseovercheck == 1)
{
setTimeout(function(){cacheobj.rotateimage()}, 100);
}
Specifically, why create a new var cacheobj rather than simply use 'this' in setTimeout()?
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
3) Describe problem:
I have read through the code and all of it makes sense, except I am stuck on one part. Could someone please explain the logic behind the cacheobj in fadeshow.prototype.rotateimage:
// If pause onMouseover enabled, cache object
if(this.pausecheck == 1)
{
var cacheobj = this;
}
if(this.mouseovercheck == 1)
{
setTimeout(function(){cacheobj.rotateimage()}, 100);
}
Specifically, why create a new var cacheobj rather than simply use 'this' in setTimeout()?