| Page 1 of 1 | [ 3 posts ] |
|
Hi,
I have been studying YUI 3 for about 3 months and now I am playing with some of its componentes, I would like to know whats wrong with the code below: Code: YUI({ filter: 'raw' }).use('anim', function (Y) { Y.on('domready', function () { //--------------------------------------------------------------------------------------------------// var animBackBoth = new Y.Anim ({ node: '#backBoth', easing: Y.Easing.backBoth, from: { height: 25, width: 100 }, to: { height: 25, width: 200 }, duration: 1.5 }); //--------------------------------------------------------------------------------------------------// var animBackIn = Y.clone(animBackBoth); animBackIn.set('node', '#backIn'); animBackIn.set('easing', Y.Easing.backIn); //--------------------------------------------------------------------------------------------------// Y.on('click', function () { animBackBoth.run(); }, '#backBoth'); Y.on('click', function () { animBackIn.run(); }, '#backIn'); }); }); My intent was to create just one instance of Anim and clone it just modifying what I wanted, from what I read from the documentation I thought I was in the right path using a deep cloning process, but when I click on '#backBoth' div what animates is '#backIn'. I would be happy if someone help me with it. Thanks in advance. Carlos Adriano Portes |
Juan Ignacio DopazoYUI Contributor
|
I don't know about "wrong", but I usually try to avoid cloning objects exactly because of these cases.
Have you tried doing something like this? Code: var animBackIn = new Y.Anim(animBackBoth.getAttrs()); |
|
jdopazo,
First of all thank you for answering, the way you showed does work and I was not aware of the way of copying attributes, by wrong I mean that the object that was cloned get its node and easing attributes changed during the clone process, I have filled a bug in order to check it out. Thank you very much. |
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group