t

Loading Panel Widget

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

                                     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-12-02 조회 3,907
11-12-02 조회 3,619
11-12-02 조회 3,003
11-12-02 조회 3,604
11-12-02 조회 3,589
11-12-02 조회 3,419
11-12-02 조회 2,933
11-12-01 조회 2,849
11-12-01 조회 3,244
11-12-01 조회 2,786
11-12-01 조회 5,498
11-12-01 조회 2,831
11-12-01 조회 3,186
11-12-01 조회 2,823
11-12-01 조회 2,929
11-12-01 조회 4,112
11-12-01 조회 3,225
11-12-01 조회 3,801
11-12-01 조회 2,892
11-11-30 조회 3,514
11-11-30 조회 4,089
11-11-30 조회 2,981
11-11-30 조회 3,417
11-11-30 조회 3,208
11-11-30 조회 3,475
11-11-30 조회 4,877
11-11-30 조회 2,875
11-11-30 조회 7,025
11-11-30 조회 2,816
11-11-29 조회 3,109
11-11-29 조회 2,809
11-11-29 조회 5,775
11-11-29 조회 2,719
11-11-29 조회 2,955
11-11-29 조회 3,375
11-11-28 조회 3,461
11-11-28 조회 2,872
11-11-28 조회 3,436
11-11-28 조회 2,994
11-11-28 조회 2,776
11-11-28 조회 4,641
11-11-28 조회 3,233
11-11-28 조회 2,766
11-11-28 조회 2,740
11-11-27 조회 4,003
11-11-26 조회 2,991
11-11-26 조회 3,439
11-11-26 조회 3,750
11-11-26 조회 4,007
11-11-25 조회 4,317
11-11-25 조회 3,426
11-11-24 조회 2,911
11-11-24 조회 2,802
11-11-24 조회 2,999
11-11-24 조회 3,207
11-11-24 조회 4,739
11-11-24 조회 2,803
11-11-24 조회 3,005
11-11-24 조회 3,104
11-11-24 조회 3,620
11-11-24 조회 2,675
11-11-23 조회 2,589
11-11-23 조회 3,763
11-11-23 조회 3,687
11-11-23 조회 4,028
11-11-22 조회 3,126
11-11-22 조회 2,749
11-11-22 조회 4,020
11-11-22 조회 3,139
11-11-22 조회 3,610
11-11-22 조회 2,806
11-11-22 조회 3,109
11-11-22 조회 3,072
11-11-22 조회 2,959
11-11-22 조회 6,754
11-11-21 조회 2,833
11-11-21 조회 2,985
11-11-21 조회 3,627
11-11-21 조회 2,808
11-11-21 조회 2,488
11-11-21 조회 2,920
11-11-19 조회 4,398
11-11-19 조회 3,858
11-11-19 조회 3,462
11-11-18 조회 5,175
11-11-18 조회 4,018
11-11-18 조회 3,135
11-11-18 조회 2,995
11-11-18 조회 3,174
11-11-17 조회 3,063
11-11-17 조회 2,529
11-11-17 조회 2,889
11-11-17 조회 3,040
11-11-17 조회 4,619
11-11-16 조회 2,885
11-11-16 조회 2,594
11-11-16 조회 2,612
11-11-16 조회 4,984
11-11-16 조회 2,943
11-11-16 조회 3,622