Hybrid View
-
16 Sep 2008 6:47 AM #1
CardLayout override which fades the cards in/out
CardLayout override which fades the cards in/out
You need to use layoutConfig: { animate: true } to make it animate.
Code:Ext.override(Ext.layout.CardLayout, { setActiveItem : function(item){ item = this.container.getComponent(item); if(this.activeItem != item){ if (item.rendered && this.animate) { Ext.Fx.syncFx(); // Correct top position of card because they have to occupy the same space // during animation. var n = item.getEl(); n.setStyle({ position: 'absolute', top: this.container.getLayoutTarget().getPadding('t') + 'px' }); if (this.activeItem) { this.activeItem.getEl().fadeOut({ useDisplay:true, callback: Ext.Component.prototype.hide, scope: this.activeItem }); } this.activeItem = item; item.show(); this.container.doLayout(); n.fadeIn({ callback: function() { n.setStyle({ position: '' }); } }); Ext.Fx.sequenceFx(); } else { if(this.activeItem){ this.activeItem.hide(); } this.activeItem = item; item.show(); this.container.doLayout(); } } } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
18 Sep 2008 4:04 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 29
I experimented a while back with fades for masks. It's a great idea if the objects are rendered.
http://tdg-i.com/img/screencasts/2008-03-13_1656.swf
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
18 Sep 2008 8:07 PM #3
Very nice.
One thing that is strange, is that with IE, after I cycle through my cards once, and then start cycling backwards, the animation quits working. Works fine in FF3, Chrome(beta).
HereThanks!
Chuck
-
18 Sep 2008 9:46 PM #4
This cross-fade CardLayout is fantastic. Thank you Animal.
To get this to work in IE, 'useDisplay:true' needs to be added to the fadeOut config:
Code:this.activeItem.getEl().fadeOut({useDisplay:true,callback: Ext.Component.prototype.hide,scope: this.activeItem});
-
18 Sep 2008 11:50 PM #5
Thanks for that hint. I've updated the code in post #1.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Sep 2008 3:53 AM #6
The fadeIn/fadeOut will work adding useDisplay: true
However, now when you bounce back and forth between the last two panels in my little test, the accordion looses any of the panels that are collapsed at the bottom. You do see them flash for a bit when leaving the accordion card going to the slider card. But when you go back to the accordion card, the panel headers (to expand) do not show up until you collapse the displayed header.
Still very nice effect.Thanks!
Chuck
-
19 Sep 2008 4:51 AM #7
OK, try the latest code. It now uses
To fade the new Panel in which restores positioning to the default.Code:n.fadeIn({ callback: function() { n.setStyle({ position: '', }); } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Sep 2008 8:28 AM #8
Appears to have not made a difference.
I will try to look at it in more detail this weekend (real work getting in the way of fun).Thanks!
Chuck
-
6 Nov 2008 2:07 PM #9


Reply With Quote