How to add custom css animation to an element in Sencha Touch? -


i have panel in sencha touch. inside of panel have button. when click on button, want increase width of panel custom css animations. have tried far.

sencha touch code:

xtype:'panel' id:'mypanel', style:'width:300px;-webkit-transition:width 2s;transition:width 2s;' items:       [         {             xtype:'button',             text:'expand',             id:'expand'         }       ] 

controller.js //on button click

 ext.getcmp('mypanel').addcls("expand"); 

custom.css

.expand { width:600px; } 

inside style of panel, have given animation. doesnot work. appreciated.

you need remove inline style. , use 2 css classes.

mypanel.js

 ext.define('myapp.view.mypanel', {  extend: 'ext.panel',   config: {      centered: true,      cls: 'colapse', // initialy added cls class      id: 'mypanel',      items: [          {              xtype: 'button',              itemid: 'mybutton',              text: 'mybutton'          }      ],      listeners: [          {              fn: 'onmybuttontap',              event: 'tap',              delegate: '#mybutton'          }      ]   },   onmybuttontap: function(button, e, eopts) {     ext.getcmp('mypanel').setcls('expand');  // resetting style on button tap }  }); 

custom.js

.expand { width:600px;-webkit-transition:width 2s;transition:width 2s; }  .colapse { width:300px;-webkit-transition:width 2s;transition:width 2s; } 

in above code added cls "colapse" panel , on button tap event set cls "expand" panel using following code "ext.getcmp('mypanel').setcls('expand')".


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -