ExtJS简单的动画效果(ext js淡入淡出特效)

简介: 1.html页面:Application HTML file - index.html ExtJs fadeIn() and fadeOut() example .

1.html页面:Application HTML file - index.html

<html>
<head>
<title>ExtJs fadeIn() and fadeOut() example</title>
  
    <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
    <style type="text/css">
 .x-panel-body{
  background-color:#8b8378;
  color:#ffffff;
 }
 </style>
    <script type="text/javascript" src="extjs/ext-all-debug.js"></script>
    <script type="text/javascript" src="app.js"></script>
  
</head>
<body>
<div id="myExample">
</div>
</body>
</html>

2.app.js :Application JavaScript file - app.js

Ext.Loader.setConfig({
 enabled: true
 });
  
Ext.application({
      
 name: 'myApp',
    appFolder: 'app',
      
    controllers: [
                  'MyController'
              ],
  
    launch: function() {
     Ext.create('Ext.container.Container', {
         renderTo: 'myExample',
            items: [
                {
                 xtype: 'myView',
                }
            ]
        });
    }
});

3.视图View: Application View - MyView.js

Ext.define('myApp.view.MyView' ,{
 extend: 'Ext.container.Container',
 alias : 'widget.myView',
   
    height: 400,
    width: 400,
    layout: {
        align: 'stretch',
        type: 'vbox'
    },
    defaults: {
     margin: '5 5 5 5'
    },
  
    initComponent: function() {
        var me = this;
  
        Ext.applyIf(me, {
            items: [
                {
                    xtype: 'button',
                    text: 'Click here to see fadeOut() effect',
                    action: 'fadeInfadeOut',
                    pressed: true,
                    enableToggle: true
                },
                {
                    xtype: 'panel',
                    height: 200,
                    html: 'Just some TEXT for ExtJs page Animation ...',
                    id: 'section',
                }
            ]
        });
  
        me.callParent(arguments);
    }
});

4.控制器:Application Controller - MyController.js

Ext.define('myApp.controller.MyController', {
   extend : 'Ext.app.Controller',
  
   //define the views
   views : ['MyView'],
     
   init : function() {
    this.control({
       
     'container' : {
      render : this.onPanelRendered
     },
     'myView button[action=fadeInfadeOut]' : {
      toggle : this.onFadeInFadeOutRequest
     }
    });
   },
  
   onPanelRendered : function() {
    console.log('The container was rendered');
   },
     
   onFadeInFadeOutRequest : function(button, pressed) {
    console.log('Button Click',pressed);
    if(!pressed){
     button.setText('Click here to see fadeIn() effect');
     Ext.get("section").fadeOut({
         opacity: 0,
         easing: 'easeOut',
         duration: 2000,
         remove: false,
         useDisplay: false
     });
    }
    else {
     button.setText('Click here to see fadeOut() effect');
     Ext.get("section").fadeIn({
         opacity: 1,
         easing: 'easeOut',
         duration: 2000
     });
    }
   }         
     
           
 });

 

目录
相关文章
|
3月前
|
JavaScript 前端开发 小程序
js vue实现回到顶部动画效果
js vue实现回到顶部动画效果
|
2月前
|
JavaScript 前端开发 Java
MooTools、Backbone、Sammy、Cappuccino、Knockout、JavaScript MVC、Google Web Toolkit、Google Closure、Ember、Batman 以及 Ext JS。
MooTools、Backbone、Sammy、Cappuccino、Knockout、JavaScript MVC、Google Web Toolkit、Google Closure、Ember、Batman 和 Ext JS 都是 JavaScript 框架,用于开发 Web 应用程序。它们分别提供了不同的功能和特性,以帮助开发者更高效地构建和维护 Web 应用程序。
17 2
|
3月前
|
移动开发 JavaScript 前端开发
分享92个JS特效动画效果,总有一款适合您
分享92个JS特效动画效果,总有一款适合您
18 0
|
3月前
|
Web App开发 移动开发 JavaScript
分享116个JS特效动画效果,总有一款适合您
分享116个JS特效动画效果,总有一款适合您
22 0
|
3月前
|
移动开发 JavaScript 前端开发
分享115个JS特效动画效果,总有一款适合您
分享115个JS特效动画效果,总有一款适合您
40 0
|
3月前
|
移动开发 JavaScript 前端开发
分享114个JS特效动画效果,总有一款适合您
分享114个JS特效动画效果,总有一款适合您
42 0
|
3月前
|
移动开发 JavaScript 前端开发
分享113个JS特效动画效果,总有一款适合您
分享113个JS特效动画效果,总有一款适合您
41 0
|
3月前
|
移动开发 前端开发 JavaScript
分享112个JS特效动画效果,总有一款适合您
分享112个JS特效动画效果,总有一款适合您
60 0
|
3月前
|
移动开发 JavaScript 前端开发
分享111个JS特效动画效果,总有一款适合您
分享111个JS特效动画效果,总有一款适合您
26 0
|
5月前
|
JavaScript
js打字机动画效果实现
js打字机动画效果实现
23 0