t

Loading Panel Widget

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

                                     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-09-19 조회 2,554
11-09-19 조회 2,476
11-09-19 조회 5,487
11-09-19 조회 6,135
11-09-16 조회 2,859
11-09-16 조회 3,111
11-09-16 조회 6,309
11-09-15 조회 3,080
11-09-15 조회 2,842
11-09-15 조회 2,509
11-09-15 조회 2,514
11-09-15 조회 2,707
11-09-15 조회 2,673
11-09-15 조회 2,792
11-09-14 조회 2,707
11-09-14 조회 3,271
11-09-14 조회 2,378
11-09-14 조회 2,302
11-09-14 조회 2,290
11-09-13 조회 2,473
11-09-10 조회 2,939
11-09-10 조회 2,565
11-09-09 조회 3,146
11-09-09 조회 3,005
11-09-09 조회 3,079
11-09-09 조회 3,125
11-09-08 조회 3,809
11-09-08 조회 5,009
11-09-08 조회 3,397
11-09-08 조회 4,335
11-09-08 조회 3,836
11-09-08 조회 3,638
11-09-08 조회 2,735
11-09-08 조회 2,301
11-09-08 조회 2,710
11-09-08 조회 2,826
11-09-07 조회 3,497
11-09-07 조회 3,557
11-09-07 조회 2,974
11-09-07 조회 2,681
11-09-07 조회 2,782
11-09-07 조회 2,802
11-09-07 조회 3,031
11-09-07 조회 2,298
11-09-07 조회 2,401
11-09-07 조회 2,559
11-09-07 조회 3,491
11-09-07 조회 2,771
11-09-06 조회 2,605
11-09-06 조회 2,879
11-09-06 조회 2,449
11-09-05 조회 2,657
11-09-05 조회 2,602
11-09-05 조회 2,882
11-09-05 조회 2,391
11-09-04 조회 2,360
11-09-04 조회 2,328
11-09-03 조회 2,497
11-09-03 조회 2,656
11-09-02 조회 3,391
11-09-02 조회 2,775
11-09-02 조회 2,636
11-09-02 조회 3,550
11-09-02 조회 2,580
11-09-02 조회 2,458
11-09-02 조회 2,462
11-09-01 조회 2,665
11-09-01 조회 2,807
11-09-01 조회 2,692
11-09-01 조회 2,688
11-09-01 조회 2,832
11-09-01 조회 2,685
11-09-01 조회 4,125
11-09-01 조회 3,723
11-09-01 조회 4,378
11-08-31 조회 2,258
11-08-31 조회 2,566
11-08-31 조회 2,856
11-08-31 조회 2,577
11-08-31 조회 2,423
11-08-31 조회 3,221
11-08-30 조회 2,972
11-08-30 조회 4,201
11-08-29 조회 2,970
11-08-29 조회 2,561
11-08-29 조회 5,174
11-08-29 조회 3,302
11-08-29 조회 2,713
11-08-29 조회 3,067
11-08-28 조회 2,467
11-08-28 조회 3,611
11-08-28 조회 2,567
11-08-28 조회 2,937
11-08-26 조회 2,470
11-08-26 조회 2,981
11-08-26 조회 3,214
11-08-26 조회 2,719
11-08-25 조회 2,555
11-08-25 조회 2,865
11-08-25 조회 2,590