我正在使用Alertify库在javascript中创建一个对话框,
alertify.myAlert || alertify.dialog('myAlert',function factory(){
return {
main:function(content){
this.setContent(content);
},
setup:function(){
return {
options:{
modal:false,
basic:true,
maximizable:false,
resizable:false,
padding:false,
visible:false
}
};
},
hooks: {
onshow: function() {
this.elements.dialog.style.height = '50%';
this.elements.dialog.style.width = '15%';
}
}
};
});并且,使用以下代码调用它..
alertify.myAlert("my html content");上线后,如何关闭?我尝试了不同的组合,如alertify.myAlert.close()、alertify.myAlert.hide(),但都不起作用。
发布于 2015-12-03 13:24:00
试试这个:-
alertify.alert().destroy(); 发布于 2015-12-04 06:36:38
@Nero,@MK :谢谢。close()和show()完成了这项工作。它们保留对话框的状态。
再问两个问题,
我们可以在alertify.dialog()实现中引用外部
Alertify.myAlert(‘我的HTML内容’);
把所有的html代码都放在这里看起来很脏。我们是否有任何选项来指定到html文件的路径?
发布于 2021-11-11 21:41:01
您可以通过应用删除来使用相同的类
$('.alertify').remove();https://stackoverflow.com/questions/34058422
复制相似问题