Rav*_*Ram 21 javascript alert toastr
我正在使用一个很酷的警报js库项目:https://github.com/CodeSeven/toastr
我希望在一段时间之后退出以下更改.查看toastr.js文件,我确实看到了选项.我只是不知道如何访问该物业'fadeAway'
toastr.info('Processing...');
Run Code Online (Sandbox Code Playgroud)
我试过了
toastr.info('Processing...', fadeAway:1000);
Run Code Online (Sandbox Code Playgroud)
如何通过传入参数来使用fadeAway?
Joh*_*apa 38
在调用toastr.info之前,请设置您选择的选项.例如:
toastr.options.fadeOut = 2500;
Run Code Online (Sandbox Code Playgroud)
这些是默认值.你可以覆盖其中许多:
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'
}
Run Code Online (Sandbox Code Playgroud)
Bri*_*den 34
使用版本2.0.3,您可以执行以下操作以使toastr显示更长:
toastr.success('Hello World', 'New Message', { timeOut: 9500 });
Run Code Online (Sandbox Code Playgroud)
您还可以在参数中传递任何选项。但是参数必须是一个对象。对于您的示例,您可以使用以下命令:
toastr.info('Processing...', { fadeAway: 1000 });
Run Code Online (Sandbox Code Playgroud)
PS:还请记住,当前版本(2.0.3)中不推荐使用fadeAway。
| 归档时间: |
|
| 查看次数: |
30467 次 |
| 最近记录: |