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;
}
精彩评论