1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-19 03:41:19 +02:00

fix live toast demo (#37590)

* fix live toast demo

* Fix live toast demo

* Update snippets.js

* Update toasts.md

* Update snippets.js

* Code review comments addressed

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
This commit is contained in:
AucT
2023-01-03 08:06:09 +02:00
committed by GitHub
parent e30916b599
commit 19d547be3d
2 changed files with 13 additions and 13 deletions

View File

@@ -90,11 +90,11 @@ We use the following JavaScript to trigger our live toast demo:
```js
const toastTrigger = document.getElementById('liveToastBtn')
const toastLiveExample = document.getElementById('liveToast')
if (toastTrigger) {
toastTrigger.addEventListener('click', () => {
const toast = new bootstrap.Toast(toastLiveExample)
toast.show()
if (toastTrigger) {
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
toastTrigger.addEventListener('click', () => {
toastBootstrap.show()
})
}
```