【发布时间】:2020-05-07 08:25:26
【问题描述】:
嗨,我开发的 swal modal 看起来像
我希望输出如下图所示
有没有办法减小按钮的大小并将确认文本放在左上角
下面是我的代码
<!DOCTYPE html>
<html>
<head>
<title>Add Checkbox dynamically to table cell using JavaScript</title>
<style>
.swal-modal {
width: 350px;
height: 200px
}
.swal-title {
margin: 0px;
font-size: 20px;
box-shadow: 0px 1px 1px ;
margin-bottom: 20px;
align-self: top
}
.swal-text {
font-size: 23px;
}
.swal-footer {
background-color: white;
margin-top: 10px;
border-top: 1px solid #E9EEF1;
overflow: hidden;
}
</style>
</head>
<body>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</body><script>
swal({
title:"Confimation ?",
text:'Do you want to save',
buttons: {
confirm: {
width:5,
text: "Save",
value: 'save',
visible: true,
className: "",
closeModal: true
},
cancel: {
width:15,
text: "Cancel",
value: 'cancel',
visible: true,
className: "",
closeModal: true
}
}
})
.then((value) => {
switch (value) {
case "save":
alert('you selected: ' + value);
break;
case "cancel":
alert('you selected: ' + value);
break;
}
});
</script>
</html>
有什么办法可以做到这一点
【问题讨论】:
标签: javascript html modal-dialog sweetalert sweetalert2