2012-06-03 14 views

回答

1

這裏有一個很大的提示:

Ext.define("App.view.Main", { 
    extend: 'Ext.tab.Panel', 

    config: { 
    fullscreen: true, 
    layout: { 
     animation: 'slide' 
    }, 
    tabBarPosition: 'bottom', 
    items:[{ 
     xtype:'panel', 
     iconCls: 'home', 
     title:'Tab 1', 
     html:'Tab1' 
    },{ 
     xtype:'panel', 
     iconCls: 'user', 
     title:'Tab 2', 
     html:'Tab2' 
    },{ 
     xtype:'panel', 
     iconCls: 'info', 
     title:'Tab 3', 
     html:'Tab3' 
    }], 
    listeners:{ 
     activeitemchange:function(){ 
     this.getLayout().setAnimation(['slide','fade','cover','reveal','pop', 'flip'][Math.floor(Math.random()*6)]); 
     } 
    } 
    } 
}); 

基本上,當用戶切換卡,它會設置了一個tabpanel的佈局之中在['slide','fade','cover','reveal','pop', 'flip']的那些新的隨機動畫;

隨意加入的方向參數

[更新]手柄方向

listeners:{ 
    activeitemchange:function(){ 
    var anim_with_direction = ['slide','cover','reveal'], 
     anim_without_direciton = ['fade','pop', 'flip'], 
     anims = anim_with_direction.concat(anim_without_direciton), 
     anim, 
     type = anims[0], 
     direction; 
    if(anim_with_direction.indexOf(type) != -1){ 
     direction = ['left','right','up','down'][Math.floor(Math.random()*4)]; 
     anim = {type:type,direction:direction}; 
    }else{ 
     anim = {type:type}; 
    } 
    this.getLayout().setAnimation(anim); 
    } 
} 
+0

感謝您的處理做出貢獻!它的訣竅是:> – Eli

+0

很高興幫助。不要忘了接受答案,然後點擊綠色的檢查標誌;) –

+0

真的很抱歉,但我可以問你在sencha設置方向的方法。我正在使用setDirection,但它不起作用 – Eli

相關問題