t

Loading Panel Widget

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

                                     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,188건
+
제목 글쓴이 날짜 조회
16-03-02 조회 3,248
16-01-19 조회 2,531
15-12-23 조회 2,962
15-12-08 조회 3,680
14-10-30 조회 5,737
14-06-06 조회 5,560
12-08-30 조회 3,916
12-08-20 조회 3,833
12-07-15 조회 5,159
12-07-13 조회 3,631
12-07-06 조회 3,858
12-06-27 조회 3,368
12-06-23 조회 3,574
12-05-03 조회 5,183
12-04-20 조회 4,128
12-03-29 조회 4,637
12-03-22 조회 4,743
12-03-22 조회 3,512
12-03-21 조회 3,286
12-03-11 조회 3,717
12-03-06 조회 4,265
12-02-22 조회 4,533
12-02-17 조회 3,332
12-02-17 조회 6,180
12-02-14 조회 6,139
12-02-06 조회 4,265
12-01-18 조회 3,219
12-01-06 조회 3,445
11-12-30 조회 3,917
11-12-30 조회 7,062
11-12-21 조회 3,284
11-12-21 조회 4,247
11-12-16 조회 3,277
11-12-15 조회 3,323
11-12-15 조회 3,424
11-12-15 조회 4,224
11-12-09 조회 3,229
11-12-09 조회 3,309
11-12-07 조회 2,877
11-12-07 조회 3,963
11-12-05 조회 4,419
11-12-02 조회 3,863
11-12-01 조회 2,738
11-12-01 조회 2,781
11-12-01 조회 2,767