t

Loading Panel Widget

· 2011-11-01 (화) 17:47:24 · 3236

                                     A YUI Loading Panel Widget


아래를 추가해서 사용하세요.
var loadingPanel = new yuiLoadingPanel();

//loadingPanel.show();
//loadingPanel.show("Processing...");
//loadingPanel.hide();

The user can close the loading box by clicking on the cancel link. If you want to handle this situation, you can subscribe to the cancelEvent:

loadingPanel.cancelEvent.subscribe(function(e, a, o){
  alert('You clicked cancel!');
});

loadingpanel.js:

$D = YAHOO.util.Dom;
$E = YAHOO.util.Event;
var yuiLoadingPanel = function(conf){
    conf = conf == undefined ? new Array() : conf;
    conf.id = conf.id == undefined ? 'yuiLoadingPanel':confi.id;
    conf.header = conf.header == undefined ? 'Loading, please wait...':conf.header;
    conf.width = conf.width == undefined ? '240px':conf.width;
    this.conf = conf;
    this.cancelEvent = new YAHOO.util.CustomEvent("cancelEvent", this);
    this.init();
	
};

yuiLoadingPanel.prototype = {
    init:function(){
        var loadingPanel = new YAHOO.widget.Panel(this.conf.id,{
            width:this.conf.width,
	    fixedcenter:true,
            close:false,
            draggable:false,
            modal:true,
            visible:false
        });
    
       loadingPanel.setBody(this.conf.header + 
               '<img src="http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif" />');
               loadingPanel.render(document.body);
               $D.addClass(loadingPanel.id, 'tcc_lightboxLoader');
               var cancelLink = document.createElement('a');
               $D.setStyle(cancelLink, 'cursor', 'pointer');
               cancelLink.appendChild(document.createTextNode('Cancel'));
               $E.on(cancelLink, 'click', function(e, o){
       	           o.self.loadingPanel.hide();
       	           o.self.cancelEvent.fire();
               }, {self:this});
               loadingPanel.appendToBody(document.createElement('br'));
               loadingPanel.appendToBody(cancelLink);
               $D.setStyle(loadingPanel.body, 'text-align', 'center');
               $D.addClass(document.body, 'yui-skin-sam');
        this.loadingPanel = loadingPanel;
    },
    show:function(text){
        if(text != undefined){
            this.loadingPanel.setHeader(text);
        }else{
	    this.loadingPanel.setHeader(this.conf.header);
	}
	this.loadingPanel.show();
    },
    hide:function(){
        this.loadingPanel.hide();
    }
};


댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
12-02-26 조회 3,179
12-02-26 조회 3,496
12-02-26 조회 3,341
12-02-26 조회 3,420
12-02-26 조회 3,465
12-02-26 조회 3,320
12-02-26 조회 3,643
12-02-26 조회 3,477
12-02-26 조회 3,561
12-02-26 조회 4,041
12-02-26 조회 2,991
12-02-26 조회 5,185
12-02-25 조회 2,751
12-02-25 조회 3,231
12-02-24 조회 2,935
12-02-24 조회 3,314
12-02-24 조회 3,292
12-02-24 조회 3,607
12-02-24 조회 3,139
12-02-24 조회 3,944
12-02-24 조회 3,915
12-02-24 조회 3,513
12-02-24 조회 9,369
12-02-23 조회 2,877
12-02-23 조회 3,322
12-02-23 조회 3,224
12-02-23 조회 3,165
12-02-23 조회 3,811
12-02-23 조회 2,896
12-02-23 조회 3,376
12-02-23 조회 3,054
12-02-23 조회 2,810
12-02-22 조회 3,710
12-02-22 조회 5,472
12-02-22 조회 3,028
12-02-22 조회 4,425
12-02-22 조회 3,296
12-02-22 조회 3,119
12-02-22 조회 4,033
12-02-22 조회 3,918
12-02-22 조회 2,845
12-02-22 조회 3,887
12-02-22 조회 4,346
12-02-22 조회 3,769
12-02-22 조회 2,949
12-02-22 조회 4,599
12-02-21 조회 3,162
12-02-21 조회 2,942
12-02-21 조회 2,847
12-02-21 조회 3,756
12-02-21 조회 3,995
12-02-21 조회 3,418
12-02-21 조회 2,930
12-02-20 조회 3,174
12-02-20 조회 3,808
12-02-20 조회 3,757
12-02-20 조회 3,039
12-02-20 조회 5,822
12-02-20 조회 3,618
12-02-20 조회 6,832
12-02-20 조회 3,230
12-02-20 조회 4,205
12-02-19 조회 3,387
12-02-18 조회 3,122
12-02-18 조회 3,865
12-02-17 조회 3,000
12-02-17 조회 4,188
12-02-17 조회 3,071
12-02-17 조회 3,633
12-02-17 조회 3,405
12-02-17 조회 6,273
12-02-17 조회 4,467
12-02-17 조회 3,093
12-02-17 조회 3,122
12-02-17 조회 3,483
12-02-16 조회 3,309
12-02-16 조회 3,380
12-02-16 조회 4,746
12-02-16 조회 2,996
12-02-16 조회 5,382
12-02-16 조회 5,130
12-02-15 조회 3,675
12-02-15 조회 3,296
12-02-15 조회 4,834
12-02-15 조회 3,327
12-02-15 조회 3,721
12-02-15 조회 2,795
12-02-15 조회 4,068
12-02-14 조회 3,585
12-02-14 조회 3,690
12-02-14 조회 4,100
12-02-14 조회 3,139
12-02-14 조회 6,221
12-02-14 조회 3,170
12-02-14 조회 4,194
12-02-13 조회 3,470
12-02-13 조회 3,088
12-02-13 조회 7,236
12-02-12 조회 2,909
12-02-12 조회 5,287