zoukankan      html  css  js  c++  java
  • ExtJS简单的动画效果(ext js淡入淡出特效)

    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,
         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
         });
        }
       }         
         
               
     });
  • 相关阅读:
    【全过程详解】如何恢复联想隐藏的内存(分区教程)
    【全过程详解】如何安装最纯净、稳定、无更新的win10系统(下载+U盘制作+安装+win10激活+驱动更新)
    第一次博客
    Spring boot 直接访问templates中html文件
    Spring boot + mybatis + orcale
    Spring boot+ maven + thymeleaf + HTML 实现简单的web项目
    HTML 中点击<a>标签,页面跳转执行过程
    orcale 使用创建日期排序然后分页每次取排序后的固定条数
    JSON语法规则
    Windows idea 搜狗输入法输入中文只显示英文
  • 原文地址:https://www.cnblogs.com/ae6623/p/4416478.html
Copyright © 2011-2022 走看看