Twitter bootstrap 使toastr警报看起来像引导警报
我想让toastr的弹出窗口看起来和引导警报一样,或者非常接近引导警报。如何执行此操作?包括引导警报的CSS,然后在您的toastr选项中,更改toastClass和IConClass的值:Twitter bootstrap 使toastr警报看起来像引导警报,twitter-bootstrap,toastr,Twitter Bootstrap,Toastr,我想让toastr的弹出窗口看起来和引导警报一样,或者非常接近引导警报。如何执行此操作?包括引导警报的CSS,然后在您的toastr选项中,更改toastClass和IConClass的值: toastr.options = { toastClass: 'alert', iconClasses: { error: 'alert-error', info: 'alert-info', success: 'alert-success',
toastr.options = {
toastClass: 'alert',
iconClasses: {
error: 'alert-error',
info: 'alert-info',
success: 'alert-success',
warning: 'alert-warning'
}
},
然后在toastr的CSS中,从#toast container>div
中删除dropshadow,使其看起来像:
#toast-container > div {
width: 300px;
}
如果您愿意,您可以保留填充,或者将其添加到您自己的CSS文件中,而不是编辑toastr(可能是最好的,只是确保以后加载您的内容)。这篇文章有点旧,但我想我会添加另一种可能的解决方案 我发现默认的引导“警报”颜色方案对于toastr消息来说有点浅。我使用了一个自定义的LESS文件,并执行了以下操作以使其变暗
#toast-container {
@darken-amount: 10%;
.toast-error {
background-color: darken(@brand-danger, @darken-amount);
}
.toast-warning {
background-color: darken(@brand-warning, @darken-amount);
}
.toast-success {
background-color: darken(@brand-success, @darken-amount);
}
.toast-info {
background-color: darken(@brand-info, @darken-amount);
}
}
您还可以选择更改消息中文本的颜色:
.toast-message {
color: #000;
}
为了使它们与bootstrap 3.2.0相同,我使用了所选答案的组合-虽然
警报错误
应该是警报危险
-和这个要点,它用图标替换图标
为了让它们看起来完全一样,我还
- 将烤面包的不透明度设置为1
- 更改标题和消息颜色以匹配引导
#toast-container > div {
opacity: 1;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
filter: alpha(opacity=100);
}
#toast-container > .alert {
background-image: none !important;
}
#toast-container > .alert:before {
position: fixed;
font-family: FontAwesome;
font-size: 24px;
float: left;
color: #FFF;
padding-right: 0.5em;
margin: auto 0.5em auto -1.5em;
}
#toast-container > .alert-info:before {
content: "\f05a";
}
#toast-container > .alert-info:before,
#toast-container > .alert-info {
color: #31708f;
}
#toast-container > .alert-success:before {
content: "\f00c";
}
#toast-container > .alert-success:before,
#toast-container > .alert-success {
color: #3c763d;
}
#toast-container > .alert-warning:before {
content: "\f06a";
}
#toast-container > .alert-warning:before,
#toast-container > .alert-warning {
color: #8a6d3b;
}
#toast-container > .alert-danger:before {
content: "\f071";
}
#toast-container > .alert-danger:before,
#toast-container > .alert-danger {
color: #a94442;
}
干得好-非常感谢!是的,我留下了CSS,因为颜色足以阻止两个警报在视觉上发生冲突。