Results 1 to 3 of 3

Thread: make a break between two animations

  1. #1
    Join Date
    Jan 2009
    Location
    Montpellier (FR)
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile make a break between two animations

    1) Script Title: Featured Content Glider

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tentglider.htm

    3) Describe problem: a mistake in my script
    hi,
    i've adjusted this script for an oscommerce's module :
    link to my contribution
    link to my website to see it
    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 :
    Code:
    config.$togglerdiv.click(function(){
                featuredcontentglider.cancelautorotate(config.togglerid)
            })
    with :
    Code:
    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 :
    Code:
    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
    Last edited by coconimo; 01-09-2009 at 11:02 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The error is actually coming from this line in the featuredcontentglider.js file:

    Code:
    	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):

    Code:
    	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)
    	},
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    coconimo (01-09-2009)

  4. #3
    Join Date
    Jan 2009
    Location
    Montpellier (FR)
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile problem solved !

    hi john,
    thanks for your help!
    your code is functional.
    Best regards !
    coco

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •