t

Loading Panel Widget

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

                                     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건
+
제목 글쓴이 날짜 조회
11-01-08 조회 2,607
11-01-08 조회 2,585
11-01-07 조회 3,200
11-01-07 조회 2,675
11-01-07 조회 2,286
11-01-07 조회 2,436
11-01-07 조회 4,619
11-01-07 조회 2,632
11-01-06 조회 2,360
11-01-06 조회 2,439
11-01-06 조회 2,164
11-01-06 조회 2,272
11-01-06 조회 2,684
11-01-06 조회 2,556
11-01-06 조회 2,301
11-01-06 조회 2,588
11-01-06 조회 2,060
11-01-06 조회 2,314
11-01-06 조회 2,447
11-01-05 조회 2,310
11-01-05 조회 2,216
11-01-05 조회 2,211
11-01-05 조회 2,392
11-01-04 조회 2,468
11-01-02 조회 2,583
11-01-02 조회 2,465
11-01-01 조회 1,878
10-12-30 조회 2,073
10-12-30 조회 2,432
10-12-30 조회 2,526
10-12-30 조회 1,892
10-12-29 조회 3,444
10-12-29 조회 2,785
10-12-29 조회 2,295
10-12-29 조회 2,333
10-12-29 조회 2,572
10-12-29 조회 3,381
10-12-29 조회 2,646
10-12-29 조회 2,423
10-12-28 조회 2,429
10-12-28 조회 2,416
10-12-28 조회 2,551
10-12-28 조회 2,129
10-12-28 조회 2,749
10-12-28 조회 2,285
10-12-28 조회 2,084
10-12-28 조회 4,115
10-12-27 조회 1,814
10-12-27 조회 2,328
10-12-27 조회 2,308
10-12-26 조회 2,364
10-12-26 조회 2,094
10-12-24 조회 2,465
10-12-24 조회 2,504
10-12-24 조회 2,129
10-12-24 조회 2,642
10-12-24 조회 2,229
10-12-24 조회 2,348
10-12-23 조회 2,554
10-12-23 조회 2,234
10-12-23 조회 2,042
10-12-23 조회 2,258
10-12-23 조회 2,579
10-12-22 조회 2,208
10-12-22 조회 2,184
10-12-22 조회 2,555
10-12-22 조회 2,391
10-12-22 조회 2,188
10-12-21 조회 2,318
10-12-21 조회 2,412
10-12-20 조회 2,172
10-12-20 조회 2,154
10-12-20 조회 1,858
10-12-20 조회 2,128
10-12-20 조회 2,379
10-12-20 조회 2,199
10-12-20 조회 2,205
10-12-19 조회 2,367
10-12-19 조회 2,942
10-12-18 조회 1,775
10-12-18 조회 2,223
10-12-18 조회 2,267
10-12-18 조회 2,164
10-12-18 조회 2,037
10-12-17 조회 2,189
10-12-17 조회 1,942
10-12-17 조회 3,264
10-12-17 조회 2,008
10-12-17 조회 2,931
10-12-17 조회 2,001
10-12-17 조회 2,049
10-12-16 조회 2,181
10-12-16 조회 2,097
10-12-16 조회 2,800
10-12-16 조회 2,237
10-12-16 조회 2,166
10-12-15 조회 2,347
10-12-15 조회 2,136
10-12-15 조회 2,002
10-12-15 조회 2,172