PDA

View Full Version : Resolved make a break between two animations



coconimo
01-06-2009, 07:13 PM
1) Script Title: Featured Content Glider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

3) Describe problem: a mistake in my script
hi,
i've adjusted this script for an oscommerce's module :
link to my contribution (http://addons.oscommerce.com/info/6172)
link to my website to see it (http://ouistiti.ke0.eu/catalog/index.php?cPath=36)
i'd like to add an option, my need :
when i click on a button (next/previous/number), the animation comes to a stop.
I would like the animation take a break, and then restarts where it was.
Here are the changes I made :
in featuredcontentglider.js :


config.$togglerdiv.click(function(){
featuredcontentglider.cancelautorotate(config.togglerid)
})

with :


config.$togglerdiv.click(function(){
if (config.autorotateafterclick==true)
featuredcontentglider.autorotate(config.togglerid)
else
featuredcontentglider.cancelautorotate(config.togglerid)
})

and in featuredcontentglider.init, i've added this line :

autorotateafterclick : true,

so, my script works with the following browsers : FF,opera,safari & chrome, but not with IE 6/7/8, i have this error :
Error : 'autorotateconfig.0' is Null or is not an object.

so, where is my mistake? i've need your lights ;)
Best regards and thanks for your help
coco

jscheuer1
01-06-2009, 08:01 PM
The error is actually coming from this line in the featuredcontentglider.js file:


autorotate:function(config){
var rotatespeed=config.speed+config.autorotateconfig[0]
window[config.togglerid+"timer"]=setInterval(function(){
if (config.totalsteps>0 && config.stepcount>=config.totalsteps){
clearInterval(window[config.togglerid+"timer"])
}
else{
config.$next.click()
config.stepcount++
}
}, rotatespeed)
},


And appears in all browsers. However, only IE will make an issue of it. You can verify that the error is occurring in other browsers by inspecting their error reporting utilities (if any). At the same time, the script appears to function identically in IE 7 and FF at least, so the error is not halting script processing.

You may have caused the situation in any number of ways, or it could be a bug in the script, but since it doesn't seem to hurt anything, some code could be added to remove the error (untested):


autorotate:function(config){
if(!config.autorotateconfig || !config.autorotateconfig[0])
return;
var rotatespeed=config.speed+config.autorotateconfig[0]
window[config.togglerid+"timer"]=setInterval(function(){
if (config.totalsteps>0 && config.stepcount>=config.totalsteps){
clearInterval(window[config.togglerid+"timer"])
}
else{
config.$next.click()
config.stepcount++
}
}, rotatespeed)
},

coconimo
01-09-2009, 11:00 AM
hi john,
thanks for your help!
your code is functional.
Best regards !
coco