Adding class to sweet alert

只谈情不闲聊 提交于 2020-02-03 07:59:27

问题


I am trying to add an extra class for my modal so I can select it from LESS and turn it's background to transparent. But customClass is not working. Is there any other way to do it. BTW I have already changed a lot with default classes so I need to do this for just one modal, can not effect the global swal.

   swal({
      title: success,
      showConfirmButton: false,
      html: true,
      customClass: ".swal-back"
   });

回答1:


The customClass option has been removed. You need to use className now instead. The period before the class name is not necessary.

swal({
  title: success,
  showConfirmButton: false,
  html: true,
  className: "swal-back"
});


来源:https://stackoverflow.com/questions/48985966/adding-class-to-sweet-alert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!