t

Loading Panel Widget

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

                                     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-01-21 조회 3,370
12-01-21 조회 4,160
12-01-21 조회 3,563
12-01-21 조회 3,234
12-01-20 조회 3,125
12-01-20 조회 2,766
12-01-20 조회 3,523
12-01-20 조회 3,356
12-01-20 조회 2,746
12-01-20 조회 3,187
12-01-20 조회 6,277
12-01-19 조회 3,304
12-01-19 조회 4,958
12-01-19 조회 3,237
12-01-19 조회 3,242
12-01-19 조회 3,203
12-01-19 조회 2,821
12-01-18 조회 3,763
12-01-18 조회 2,974
12-01-18 조회 2,715
12-01-18 조회 3,289
12-01-18 조회 2,944
12-01-18 조회 3,133
12-01-17 조회 2,925
12-01-17 조회 4,018
12-01-17 조회 4,448
12-01-17 조회 3,305
12-01-17 조회 3,419
12-01-17 조회 3,172
12-01-17 조회 5,244
12-01-17 조회 3,038
12-01-16 조회 2,776
12-01-16 조회 3,626
12-01-16 조회 4,116
12-01-15 조회 2,925
12-01-15 조회 3,739
12-01-15 조회 3,697
12-01-14 조회 3,589
12-01-14 조회 3,734
12-01-14 조회 3,466
12-01-14 조회 1.1만
12-01-14 조회 3,677
12-01-14 조회 3,999
12-01-14 조회 2,951
12-01-14 조회 2,797
12-01-13 조회 2,941
12-01-13 조회 3,523
12-01-13 조회 4,591
12-01-13 조회 2,933
12-01-12 조회 4,246
12-01-12 조회 4,385
12-01-12 조회 3,393
12-01-12 조회 3,220
12-01-11 조회 2,808
12-01-11 조회 3,252
12-01-11 조회 3,467
12-01-11 조회 3,188
12-01-11 조회 3,193
12-01-11 조회 3,300
12-01-11 조회 3,511
12-01-11 조회 4,293
12-01-11 조회 3,374
12-01-11 조회 2,835
12-01-11 조회 1.2만
12-01-11 조회 3,161
12-01-10 조회 2,968
12-01-10 조회 3,686
12-01-10 조회 4,752
12-01-10 조회 3,440
12-01-10 조회 3,154
12-01-10 조회 2,894
12-01-10 조회 3,806
12-01-10 조회 3,069
12-01-10 조회 4,586
12-01-10 조회 2,965
12-01-10 조회 3,002
12-01-10 조회 3,195
12-01-10 조회 3,830
12-01-10 조회 2,898
12-01-10 조회 4,527
12-01-10 조회 2,912
12-01-10 조회 5,389
12-01-10 조회 5,569
12-01-10 조회 5,447
12-01-10 조회 5,346
12-01-09 조회 2,865
12-01-09 조회 2,790
12-01-09 조회 3,323
12-01-09 조회 3,848
12-01-09 조회 2,797
12-01-09 조회 2,960
12-01-09 조회 2,764
12-01-08 조회 7,103
12-01-08 조회 2,779
12-01-08 조회 7,190
12-01-08 조회 3,713
12-01-08 조회 3,311
12-01-08 조회 2,714
12-01-08 조회 2,867
12-01-08 조회 3,505