Reputation: 135
I'm using toastr.error('Testing pop-up')
in Javascript to show me a pop-up when there is an error in the application, but I can't see in the official documentation how to close this pop-up after X seconds automatically without pressing any button. Does anyone know how?
Upvotes: 0
Views: 1172
Reputation: 36594
The signature for the error
function is:
function error(message, title, optionsOverride) {
https://github.com/CodeSeven/toastr/blob/50092cc604850a16c985520b63df184d3e0b4086/toastr.js#L46
You can pass options to hide it as needed.
You can play with the options to see the best fit in the demo page:
https://codeseven.github.io/toastr/demo.html
Upvotes: 1
Reputation: 8162
You can set timeout like:
Timeouts
Control how toastr interacts with users by setting timeouts appropriately.
toastr.options.timeOut = 30; // How long the toast will display without user interaction
toastr.options.extendedTimeOut = 60; // How long the toast will display after a user hovers over it
Reference:
Upvotes: 1