有没有办法去改变它?我尝试将toastClass定义为一个不透明度设置为1的类,但是没有看到任何变化:
.toast-style{
opacity: 1;
}
toastr.options.toastClass = 'toast-style';
有没有办法去改变它?我尝试将toastClass定义为一个不透明度设置为1的类,但是没有看到任何变化:
.toast-style{
opacity: 1;
}
toastr.options.toastClass = 'toast-style';
不需要 JavaScript。你应该能够使用 CSS 更改此内容,可以选择以下方式之一:
#toast-container > div {
opacity:1;
}
.toast {
opacity: 1 !important;
}
#toast-container > div {
opacity: 1;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
filter: alpha(opacity=100);
}
我需要为单个toastr执行此操作,因此选择了这种方法:
toastr.options = {
...
};
toastr.info(
'All of my favorite singers have stolen all of my best lines',
'The Title'
);
$('#toast-container').addClass('nopacity');
#toast-container.nopacity > div {
opacity: 1;
}
.toast-error { background-color: rgba(255,111,105,0.7) !important; }
将“〜ngx-toastr/toastr.css”中的所有CSS复制到应用程序的styles.css文件中对我有用。
"styles": [
"styles.scss",
"node_modules/ngx-toastr/toastr.css" // try adding '../' if you're using angular cli before 6
]
toastr
调用的使用都很好(半透明),但如果用户执行了某个特殊操作,我们希望以醒目的方式(不透明)展示它,并等待他们关闭。 - Don Cheadle!important
几乎总是有害的。 - Madbreakstoastr.options{..}
中设置不透明度。根据 toast 消息显示的位置,它有时会与背景混合。我希望所有消息都是100%完全不透明的 - 没有透明度。 - Stack Undefined