甜蜜警报打开动画禁用

sweet alert open animation disable

我正在使用甜蜜警报插件,即使在打开设置选项动画 : false 之后我也会收到甜蜜警报打开动画(淡入-淡出)即将到来。如何禁用 it.sweet alertsweet 警报

原版sweet alert插件不支持,建议使用SweetAlert2插件

迁移很简单,这里是迁移指南:Migration from SweetAlert to SweetAlert2

这是 SweetAlert2 和禁用动画的示例:

Swal.fire({
  icon: 'success',
  title: 'SweetAlert2 modal without animation',
  showClass: {
    backdrop: 'swal2-noanimation', // disable backdrop animation
    popup: '',                     // disable popup animation
    icon: ''                       // disable icon animation
  },
  hideClass: {
    popup: '',                     // disable popup fade-out animation
  }
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  

这是我禁用动画的解决方案。

如果要删除缩放动画,请将其添加到主 css 文件中:

.swal-overlay--show-modal, .swal-modal {
    animation: none !important;
}

如果你也想删除不透明动画,也添加这个:

.swal-overlay{
    transition: none !important;
}