eugenii / jqueryrotate

Automatically exported from code.google.com/p/jqueryrotate
1 stars 0 forks source link

callback does not behave as expected #95

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a class of images and execute the animateTo on the class of objects
2. Bind a call back to the images
3. console.log in the call back

What is the expected output? What do you see instead?
The call back should occur once.
It occurs for every item in the node list.

Original issue reported on code.google.com by akari.no...@gmail.com on 10 May 2013 at 12:32

GoogleCodeExporter commented 9 years ago
I cant say its a bug as you can handle this case manually. If plugin would fire 
only one callback for all of items you would be limited if you would like to 
have separate action for each item.

Manually handle this case is easy - just count items and store this value. In 
callback decrease this value and fire your function when it reach 0. 

Original comment by wil...@gmail.com on 10 May 2013 at 6:49

GoogleCodeExporter commented 9 years ago
jQuery provides that functionality inherently.

With the .each function
So, for your case it would be
$('.classOfImage').each(function(){$(this).rotate({animate:80,
callback:callbackFunction})});

This is a bug as it breaks the jquery promisability.

Original comment by akari.no...@gmail.com on 10 May 2013 at 12:47

GoogleCodeExporter commented 9 years ago
You're wrong. Jquery promises that it can fire given "function" for "each" item 
you selected. Inside this function you say: 

For currently iterated element rotate it using parameters X. Repeat this steap 
for "each" item.

Jquery never promises that, what you're ask for... Don't get me wrong, but that 
would be ... really bad.

Original comment by wil...@gmail.com on 10 May 2013 at 12:54