单击取消按钮时,ngSweetAlert垂直滚动条消失

时间:2016-05-24 08:48:36

标签: angularjs angular-fullstack sweetalert

我在我的项目中使用subclass

除非我添加了SweetAlert.swal({ title: "Are you sure?", text: "Your will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false}, function(){ //do something if "Yes, delete it!" button is clicked }); 属性,否则它的效果非常好。

确实,例如:

overflow-y: auto;

当它被调用时,会出现甜蜜警报窗口,此时,垂直滚动条被禁用,直到现在都没问题。

在这种情况下,用户有两种选择:

  • 点击按钮"是,删除它!" :甜蜜警报消失,我的垂直滚动条返回。
  • 点击按钮"取消" : 所以甜蜜的警报消失但是我的问题是我的垂直滚动条仍然是禁用的事实,情况应该不是这样!

一种可能的解决方案是在我的<body> html标记上添加ul css属性,但问题是在显示甜蜜警报时不会禁用垂直滚动条。 (理想情况下,这不是我想要的......)

之前是否有人已经遇到此问题?

1 个答案:

答案 0 :(得分:1)

我解决了我的问题,你只需要添加:

closeOnCancel: true

所以现在看起来像这样:

SweetAlert.swal({
   title: "Are you sure?",
   text: "Your will not be able to recover this imaginary file!",
   type: "warning",
   showCancelButton: true,
   confirmButtonColor: "#DD6B55",
   confirmButtonText: "Yes, delete it!",
   closeOnConfirm: false,
   closeOnCancel: true}, 
function(){ 
   //do something if "Yes, delete it!" button is clicked
});
相关问题