最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Sencha touch application loading mask - Stack Overflow

programmeradmin1浏览0评论

I have a sencha touch application, but want to apply a loading mask to the entire app while the page is loading. (i.e. while the Javascript files etc are loading)

In ExtJS, I used to have a full sized div with a loading image, then as the first action of the "onReady" I used to fade that div out then remove it. Unfortunately, fadeOut() doesnt seem to be available in SenchaTouch

My app definition is as follows:

Ext.application({
    name: 'MyApp',

    launch: function() {
        Ext.create('Ext.Panel', {
            fullscreen: true,
            html: 'Hello World'
        });
    }
});

Any pointers would be appretiated

I have a sencha touch application, but want to apply a loading mask to the entire app while the page is loading. (i.e. while the Javascript files etc are loading)

In ExtJS, I used to have a full sized div with a loading image, then as the first action of the "onReady" I used to fade that div out then remove it. Unfortunately, fadeOut() doesnt seem to be available in SenchaTouch

My app definition is as follows:

Ext.application({
    name: 'MyApp',

    launch: function() {
        Ext.create('Ext.Panel', {
            fullscreen: true,
            html: 'Hello World'
        });
    }
});

Any pointers would be appretiated

Share Improve this question edited Oct 13, 2011 at 22:40 neolaser asked Oct 13, 2011 at 5:53 neolaserneolaser 6,90719 gold badges59 silver badges92 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

You can make use of the Ext.LoadMask class. There is an example:

var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
myMask.show();

When you finish loading some Ajax requests or doing your task and to remove the mask, you can:

myMask.hide();

Hey you can also try this below code while doing ajax request and loading data

var mask = new Ext.LoadMask(Ext.getBody(), {msg:"wait msg..."});                


                Ext.Ajax.on('beforerequest', function(){        

                        mask.show();
                });


                Ext.Ajax.on('requestplete', function(){      

                        mask.hide();
                });             


                Ext.Ajax.on('requestexception', function(){         

                });

Here is how I go about it:

Ext.getBody().mask().addCls('black-background');

.black-background {
  opacity: 1;
  background: black;
}
发布评论

评论列表(0)

  1. 暂无评论