2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-17 19:21:23 +03:00

Add dynamic, live alerts example to docs (#33866)

This commit is contained in:
Mark Otto
2021-06-29 08:46:25 -07:00
committed by GitHub
parent d314466a4d
commit 696996dd4f
3 changed files with 70 additions and 1 deletions
+15 -1
View File
@@ -41,7 +41,7 @@ Toasts are as flexible as you need and have very little required markup. At a mi
</div>
{{< /example >}}
### Live
### Live example
Click the button below to show a toast (positioned with our utilities in the lower right corner) that has been hidden by default with `.hide`.
@@ -81,6 +81,20 @@ Click the button below to show a toast (positioned with our utilities in the low
</div>
```
We use the following JavaScript to trigger our live toast demo:
```js
var toastTrigger = document.getElementById('liveToastBtn')
var toastLiveExample = document.getElementById('liveToast')
if (toastTrigger) {
toastTrigger.addEventListener('click', function () {
var toast = new bootstrap.Toast(toastLiveExample)
toast.show()
})
}
```
### Translucent
Toasts are slightly translucent to blend in with what's below them.