PDA

View Full Version : Fading an element out.



neural
22 Sep 2010, 10:14 PM
I'm using Sencha Touch 0.93 and it seems there's no .fadeOut() method althought it's listed in the ExtJS documentation. Are these kind of effects just different in Sencha touch or was this overlooked?

evant
22 Sep 2010, 11:05 PM
Ext.setup({
icon: 'icon.png',
glossOnIcon: false,
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
onReady: function(){
var el = Ext.getBody().createChild({
tag: 'div',
style: 'background-color: red; width: 100px; height: 100px;'
});
Ext.select('.x-body-stretcher').remove();
Ext.Anim.run(el, 'fade', {
duration: 5000
});
}
});

neural
22 Sep 2010, 11:09 PM
Weird, I just ran this in my inspector and got "undefined" back.


Ext.Anim.run(Ext.get("divID"), "fade", {duration: 1000})

neural
22 Sep 2010, 11:15 PM
Nevermind, it definitely did work, just had to set the parameter to show it and ignore the fact that it doesn't return anything.

evant
22 Sep 2010, 11:15 PM
Why is that weird? What would you expect that function to return?

neural
22 Sep 2010, 11:23 PM
Because most functions return an object so that you can chain methods. The really weird thing is that this isn't built into the elements somehow like it is in the regular ExtJS framework. jQuery is extremely elegant with these types of things. $("#divID").fadeIn().delay(1000).fadeOut() is really all that should be needed for this kind of thing.