开发者

MooDialog.Request add Event

开发者 https://www.devze.com 2023-02-05 17:55 出处:网络
How can I add a close event to MooDialog.Request? Update: There is my code: window.addEvent(\'domready\', function(){

How can I add a close event to MooDialog.Request?

Update: There is my code:

window.addEvent('domready', function(){
  $('xyz').addEvent('click', function(e) {
    e.stop();
    var reqDialog = new MooDialog.Request(url,
      开发者_运维技巧{view:'show'},
      {
        size:  {
          width: 460,
          height: 375,
          'zIndex':20
        }
      }
    );
    reqDialog.setRequestOptions({
        onClose: function(){
            alert('closed');
        }
    });
  });
});


It's pretty simple:

//Request => new MooDialog.Request(url[, RequestOptions, options]);
var reqD = new MooDialog.Request('URL',null,{
    onClose: function(){
        alert('closed');
    }
});

doc

Edit your code need to be updated this way:

window.addEvent('domready', function(){
  $('xyz').addEvent('click', function(e) {
    e.stop();
    var reqDialog = new MooDialog.Request(url, null, {
        class:'dialogClass',
        autoOpen: false,
        onClose: function(){
            alert('closed');
        }
    });

    reqDialog.open();

    /* 
        if you want to add some custom requestOptions, you need to do i.e.:
        reqDialog.setRequestOptions({
           onRequest: function(){
              reqDialog.setContent('loading...');
           }
        }).open();
    */
}); 

and you need some css to define the style of the dialog by dialogClass:

.dialogClass{
    width:460;
    height:375;
    z-index:20;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消