Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having issues using effect.queues in conjunction with callbacks with script.aculo.us

    The below function works perfectly fine, but in my attempt to add a scope queue
    to the doSomething2() function so I can give it a scope of 'nbaeffect' like
    doSomething3() and apply a limit of 2 to both in order to supress the amount
    of effects that are queue, nothingd happens and I'm not generating a javascript
    error. Not sure what I'm doing wrong.

    This Code works fine but, the modified code that I'm having issues with
    is below this code:
    Code:
    function doSomething3(){
    	new Effect.Fade('logo', {queue: { position: 'end', scope: 'nbaeffect'}});
    }
    
    function doSomething2(){	
    	new Effect.Fade('view',
    	{		
    		afterFinish: function (effect) 
    		{
    		 new Effect.Fade('logo');	
    	     doSomething();
    		 }
    	});	
    }	
    
    
    function addObservers()
    {
    $('NBA').observe('change', doSomething3);
    $('NBA').observe('change', doSomething2);
    }
    
    Event.observe(window, 'load', addObservers);
    The issue is with adding an effect queue and scope to doSomething2()
    Code:
    function doSomething3(){
    	new Effect.Fade('logo', {queue: { position: 'end', scope: 'nbaeffect'}});
    }
    
    function doSomething2(){	
    	new Effect.Fade('view', {queue: {position: 'end', scope: 'nbaeffect'}},
    	{		
    		afterFinish: function (effect) 
    		{
    		 new Effect.Fade('logo');	
    	     doSomething();
    		 }
    	});	
    }	
    
    
    function addObservers()
    {
    $('NBA').observe('change', doSomething3);
    $('NBA').observe('change', doSomething2);
    }
    
    Event.observe(window, 'load', addObservers);
    Last edited by cd_gary; 09-04-2009 at 02:19 PM.

  • #2
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    i think queue needs to be included in the array of args.... in other words you're closing the brackets to early...

    insted of
    Code:
    function doSomething2(){	
    	new Effect.Fade('view', {queue: {position: 'end', scope: 'nbaeffect'}},
    	{		
    		afterFinish: function (effect) 
    		{
    		 new Effect.Fade('logo');	
    	     doSomething();
    		 }
    	});	
    }
    try
    Code:
    function doSomething2(){	
    	new Effect.Fade('view', {queue: {position: 'end', scope: 'nbaeffect'},
    	afterFinish: function (effect){
    		 new Effect.Fade('logo');	
    	         doSomething();
    		 }
    	});	
    }
    so basically instead of saying "new Effect.Fade('id', {params});" you were saying "new Effect.Fade('id', {queue},{params});"... which is almost certainly no good.


  •  

    Posting Permissions

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