t

Loading Panel Widget

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

                                     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건
+
제목 글쓴이 날짜 조회
11-11-16 조회 3,512
11-11-15 조회 2,626
11-11-15 조회 3,258
11-11-15 조회 2,704
11-11-14 조회 2,795
11-11-14 조회 3,740
11-11-14 조회 3,544
11-11-14 조회 4,231
11-11-14 조회 2,830
11-11-14 조회 2,740
11-11-13 조회 4,036
11-11-12 조회 2,673
11-11-12 조회 2,792
11-11-12 조회 4,019
11-11-11 조회 2,920
11-11-11 조회 2,867
11-11-11 조회 2,540
11-11-11 조회 2,861
11-11-11 조회 3,996
11-11-11 조회 2,456
11-11-11 조회 4,694
11-11-11 조회 2,728
11-11-11 조회 2,558
11-11-11 조회 2,426
11-11-11 조회 2,839
11-11-11 조회 2,624
11-11-11 조회 2,617
11-11-10 조회 3,055
11-11-10 조회 2,522
11-11-10 조회 3,155
11-11-10 조회 3,713
11-11-10 조회 2,415
11-11-10 조회 2,546
11-11-10 조회 2,375
11-11-09 조회 2,576
11-11-09 조회 3,286
11-11-09 조회 2,756
11-11-09 조회 2,894
11-11-08 조회 2,664
11-11-08 조회 3,000
11-11-08 조회 2,334
11-11-08 조회 3,273
11-11-08 조회 2,567
11-11-08 조회 3,344
11-11-06 조회 1만
11-11-06 조회 2,637
11-11-06 조회 3,631
11-11-06 조회 3,446
11-11-06 조회 3,748
11-11-06 조회 3,931
11-11-05 조회 2,467
11-11-05 조회 2,636
11-11-04 조회 8,545
11-11-04 조회 2,593
11-11-04 조회 2,647
11-11-04 조회 3,652
11-11-04 조회 2,547
11-11-04 조회 2,729
11-11-03 조회 3,987
11-11-03 조회 2,650
11-11-03 조회 5,620
11-11-02 조회 5,899
11-11-01 조회 3,180
11-11-01 조회 2,628
11-11-01 조회 3,231
11-11-01 조회 2,523
11-11-01 조회 2,859
11-11-01 조회 2,386
11-11-01 조회 9,409
11-11-01 조회 2,956
11-10-31 조회 2,337
11-10-27 조회 2,603
11-10-26 조회 3,195
11-10-26 조회 2,689
11-10-26 조회 2,545
11-10-26 조회 2,563
11-10-26 조회 2,453
11-10-25 조회 2,508
11-10-25 조회 2,608
11-10-25 조회 2,552
11-10-25 조회 2,531
11-10-24 조회 2,573
11-10-24 조회 2,841
11-10-24 조회 2,846
11-10-23 조회 3,228
11-10-23 조회 2,804
11-10-23 조회 2,692
11-10-21 조회 2,549
11-10-21 조회 2,474
11-10-21 조회 2,463
11-10-21 조회 2,853
11-10-20 조회 4,031
11-10-19 조회 2,524
11-10-19 조회 2,921
11-10-19 조회 4,043
11-10-19 조회 3,191
11-10-19 조회 2,887
11-10-19 조회 6,711
11-10-18 조회 4,046
11-10-18 조회 2,615