我正在使用一个很酷的警报js库 项目:https://github.com/CodeSeven/toastr
我想在一段时间后淡出以下警报。 查看toastr.js文件,我确实看到选项已经存在。 我只是不知道如何访问属性'fadeAway'
toastr.info('Processing...');
我试过了
toastr.info('Processing...', fadeAway:1000);
我如何通过传入参数使用"fadeAway"效果?
我正在使用一个很酷的警报js库 项目:https://github.com/CodeSeven/toastr
我想在一段时间后淡出以下警报。 查看toastr.js文件,我确实看到选项已经存在。 我只是不知道如何访问属性'fadeAway'
toastr.info('Processing...');
我试过了
toastr.info('Processing...', fadeAway:1000);
我如何通过传入参数使用"fadeAway"效果?
使用2.0.3版本,您可以执行以下操作使toastr显示更长时间:
toastr.success('Hello World', 'New Message', { timeOut: 9500 });
在调用toastr.info函数之前,设置你选择的选项。例如:
toastr.options.fadeOut = 2500;
您可以在此演示中查看许多选项:toastr演示
这些是默认值。您可以覆盖其中的许多选项:
options = {
tapToDismiss: true,
toastClass: 'toast',
containerId: 'toast-container',
debug: false,
fadeIn: 300,
fadeOut: 1000,
extendedTimeOut: 1000,
iconClass: 'toast-info',
positionClass: 'toast-top-right',
timeOut: 5000, // Set timeOut to 0 to make it sticky
titleClass: 'toast-title',
messageClass: 'toast-message'
}
toastr.info('Processing...', { fadeAway: 1000 });
PS:还要记住,fadeAway在当前版本(2.0.3)已经被弃用。