t

Loading Panel Widget

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

                                     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건
+
제목 글쓴이 날짜 조회
12-01-11 조회 2,755
12-01-11 조회 1.2만
12-01-10 조회 2,852
12-01-08 조회 3,445
12-01-05 조회 5,335
11-12-29 조회 3,054
11-12-27 조회 2,839
11-12-25 조회 3,021
11-12-22 조회 3,456
11-12-14 조회 2,920
11-12-12 조회 3,540
11-11-28 조회 3,377
10-10-19 조회 2,836
08-09-05 조회 3,756
08-09-05 조회 3,571
08-06-14 조회 3,315
08-04-22 조회 3,593
08-04-17 조회 3,597
07-10-03 조회 4,213
07-10-03 조회 3,608
07-10-03 조회 7,290
07-10-03 조회 4,569
07-10-03 조회 3,265
07-10-03 조회 2,855
07-10-02 조회 3,571
07-10-02 조회 3,101
07-09-27 조회 5,022
07-09-27 조회 3,846
06-09-26 조회 3,515
06-09-26 조회 4,733
06-09-22 조회 3,908
06-09-22 조회 3,523
06-09-22 조회 4,269
06-09-21 조회 4,204
06-08-18 조회 3,693
05-11-30 조회 4,744
05-07-15 조회 4,591
05-03-23 조회 4,655
05-03-14 조회 3,321
05-03-13 조회 2,697
04-08-05 조회 5,769