diff --git a/README.md b/README.md index 1936395..36186dd 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ If `gravity` is equals to `bottom`, it will be pushed from bottom. |-----------------|----------------------|----------------------------------------------------------------------------|-------------| | text | string | Message to be displayed in the toast | "Hi there!" | | node | ELEMENT_NODE | Provide a node to be mounted inside the toast. `node` takes higher precedence over `text` | | -| duration | number | Duration for which the toast should be displayed.
-1 for permanent toast | 3000 | +| duration | number | Duration for which the toast should be displayed.
`-1` or `Infinity` for permanent toast | 3000 | | selector | string \| ELEMENT_NODE | ShadowRoot | CSS Selector or Element Node on which the toast should be added | body | | destination | URL string | URL to which the browser should be navigated on click of the toast | | | newWindow | boolean | Decides whether the `destination` should be opened in a new window or not | false | diff --git a/src/toastify.js b/src/toastify.js index 5d9659c..2ef717d 100644 --- a/src/toastify.js +++ b/src/toastify.js @@ -198,7 +198,7 @@ } // Clear timeout while toast is focused - if (this.options.stopOnFocus && this.options.duration > 0) { + if (this.options.stopOnFocus && this.options.duration > 0 && this.options.duration !== Infinity) { var self = this; // stop countdown divElement.addEventListener(