t

Loading Panel Widget

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

                                     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-11-16 조회 3,546
11-11-15 조회 2,662
11-11-15 조회 3,298
11-11-15 조회 2,749
11-11-14 조회 2,847
11-11-14 조회 3,796
11-11-14 조회 3,601
11-11-14 조회 4,285
11-11-14 조회 2,876
11-11-14 조회 2,779
11-11-13 조회 4,068
11-11-12 조회 2,704
11-11-12 조회 2,835
11-11-12 조회 4,062
11-11-11 조회 2,966
11-11-11 조회 2,911
11-11-11 조회 2,583
11-11-11 조회 2,903
11-11-11 조회 4,047
11-11-11 조회 2,511
11-11-11 조회 4,754
11-11-11 조회 2,780
11-11-11 조회 2,598
11-11-11 조회 2,464
11-11-11 조회 2,880
11-11-11 조회 2,656
11-11-11 조회 2,657
11-11-10 조회 3,106
11-11-10 조회 2,569
11-11-10 조회 3,198
11-11-10 조회 3,764
11-11-10 조회 2,457
11-11-10 조회 2,589
11-11-10 조회 2,419
11-11-09 조회 2,626
11-11-09 조회 3,348
11-11-09 조회 2,826
11-11-09 조회 2,968
11-11-08 조회 2,721
11-11-08 조회 3,055
11-11-08 조회 2,381
11-11-08 조회 3,338
11-11-08 조회 2,629
11-11-08 조회 3,407
11-11-06 조회 1만
11-11-06 조회 2,697
11-11-06 조회 3,698
11-11-06 조회 3,501
11-11-06 조회 3,805
11-11-06 조회 3,990
11-11-05 조회 2,531
11-11-05 조회 2,695
11-11-04 조회 8,593
11-11-04 조회 2,643
11-11-04 조회 2,700
11-11-04 조회 3,710
11-11-04 조회 2,599
11-11-04 조회 2,774
11-11-03 조회 4,038
11-11-03 조회 2,717
11-11-03 조회 5,683
11-11-02 조회 5,955
11-11-01 조회 3,242
11-11-01 조회 2,689
11-11-01 조회 3,307
11-11-01 조회 2,590
11-11-01 조회 2,929
11-11-01 조회 2,447
11-11-01 조회 9,464
11-11-01 조회 3,015
11-10-31 조회 2,395
11-10-27 조회 2,656
11-10-26 조회 3,242
11-10-26 조회 2,737
11-10-26 조회 2,591
11-10-26 조회 2,618
11-10-26 조회 2,504
11-10-25 조회 2,569
11-10-25 조회 2,672
11-10-25 조회 2,610
11-10-25 조회 2,592
11-10-24 조회 2,620
11-10-24 조회 2,906
11-10-24 조회 2,918
11-10-23 조회 3,290
11-10-23 조회 2,877
11-10-23 조회 2,776
11-10-21 조회 2,621
11-10-21 조회 2,544
11-10-21 조회 2,532
11-10-21 조회 2,931
11-10-20 조회 4,085
11-10-19 조회 2,588
11-10-19 조회 3,001
11-10-19 조회 4,116
11-10-19 조회 3,270
11-10-19 조회 2,978
11-10-19 조회 6,802
11-10-18 조회 4,136
11-10-18 조회 2,683