我有Sweetalert如下:
swal({
title: "my title",
text: "",
type: "input",
imageUrl: "images/my_image.png",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top",
inputPlaceholder: "username..."
},
function(inputValue){
if (inputValue === false) return false;
if (inputValue === "") {
swal.showInputError("you didn't type anything...");
return false
}
});
如何更改sweetalert中显示的 inputPlaceholder 的颜色。我试过了:
.sweet-alert input::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: whitesmoke;
padding-left: 4px;
}
.sweet-alert input::-moz-placeholder { /* Firefox 19+ */
color: whitesmoke;
padding-left: 4px;
}
.sweet-alert input:-ms-input-placeholder { /* IE 10+ */
color: whitesmoke;
padding-left: 4px;
}
.sweet-alert input:-moz-placeholder { /* Firefox 18- */
color: whitesmoke;
padding-left: 4px;
}
.inputPlaceholder {
color: white !important;
}
答案 0 :(得分:0)
找到解决方案。在sweetalert.css文件中有与placehodler相关的这些行:
.sweet-alert input:focus::-moz-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.9; }
.sweet-alert input:focus:-ms-input-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.9; }
.sweet-alert input:focus::-webkit-input-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.9; }
.sweet-alert input::-moz-placeholder {
color: whitesmoke; }
.sweet-alert input:-ms-input-placeholder {
color: whitesmoke; }
.sweet-alert input::-webkit-input-placeholder {
color: whitesmoke; }
只需要改变不透明度和颜色。