如何将 jquery 确认转换为 sweet-alert 确认?

How to convert jquery confirm to sweet-alert confirmation?

我有这个 jquery 确认码,我试图将其转换为甜蜜警报确认。

我目前的 jquery:

$('#nav-logout').click(function(){
    var res = confirm('Would you like to log out from the system?');
    if(res) {
        return true;
    }
    return false;
});

有人可以帮助我如何根据上面的代码将此代码转换为甜蜜警报确认。谢谢!

这是设置起来有多么容易的代码示例

$("#nav-logout").click(function(e) {
  e.preventDefault()
    swal({
  title : "",
  text : "Would you like to log out from the system?",
        type : "warning",
        showCancelButton: true,
        confirmButtonText: "Yes",
   },
function(isConfirm){
  if (isConfirm) {
      //window.location="logut page url"; // if you need redirect page 
    alert("Press Yes");
  } else {
     alert("Cancelled");
  }
    })
});
<script src="http://tristanedwards.me/u/SweetAlert/lib/sweet-alert.js"></script>
<link href="http://tristanedwards.me/u/SweetAlert/lib/sweet-alert.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<a href="http://anything.com" title="r" class="nav-tools" id="nav-logout">Logout</a>