问题
Is there any way to change it? I tried defining the toastClass as a class with opacity set to 1, but saw no changes:
.toast-style{
opacity: 1;
}
toastr.options.toastClass = 'toast-style';
回答1:
No JavaScript required for this. You should be able to change this in CSS using either
#toast-container > div {
opacity:1;
}
or
.toast {
opacity: 1 !important;
}
回答2:
#toast-container > div {
opacity: 1;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
filter: alpha(opacity=100);
}
Test Working Example;
回答3:
I needed to do this for a single toastr so went this route:
toastr.options = {
...
};
toastr.info(
'All of my favorite singers have stolen all of my best lines',
'The Title'
);
$('#toast-container').addClass('nopacity');
...and then...
#toast-container.nopacity > div {
opacity: 1;
}
来源:https://stackoverflow.com/questions/17635655/setting-toastr-opacity