| Page 1 of 1 | [ 3 posts ] |
|
I am using Anim to animate certain elements in a document.
I have setted the final positions of the elements in CSS, so that if the user does not have Javascript enabled, he will just see the page without any animations. I have a div called content that is aligned in the middle of the page using top: 50% and left: 50%. This way, no matter what happens, when the window is resized, the content div is centered horizontally and vertically. This is the code I am using: Code: YUI().use('anim', function(Y) { var anim = new Y.Anim({ node: '#content', from: { top: function(node) { return Y.one('body').getStyle('height'); }, opacity: 0, }, to: { top: function(node) { Y.log(node.getStyle('top')); return node.getStyle('top'); }, opacity: 1, }, duration: 0.8, easing: 'backOut', }); anim.run(); }); The problem is that while the animation works properly, once the animation ends, the "top" property is set to a pixel amount and not 50%. This causes the content div to not be centered vertically when the window is resized. I have tried setting the final top property to '50%' manually, but the animation does not give the intended effect. Is there anyway to get the div centered vertically after the animation with only CSS? |
|
Try subscribing to the "end" event and then setting the value.
|
|
Thanks.
That's what I ended up doing |
| 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