From d2477abecdf03f242bcb166c463b7ec5ce5fc7bd Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 18 Jan 2021 20:59:59 +0200 Subject: [PATCH] Backport #32760 (#32827) Add a live toast example to the docs --- site/assets/js/application.js | 7 +++- site/content/docs/4.5/components/toasts.md | 44 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/site/assets/js/application.js b/site/assets/js/application.js index 8f0cddd8a4cf..d9f8d1a4a4e0 100644 --- a/site/assets/js/application.js +++ b/site/assets/js/application.js @@ -24,12 +24,17 @@ $('[data-toggle="popover"]').popover() - $('.toast') + $('.bd-example .toast') .toast({ autohide: false }) .toast('show') + // Live toast demo + $('#liveToastBtn').click(function () { + $('#liveToast').toast('show') + }) + // Demos within modals $('.tooltip-test').tooltip() $('.popover-test').popover() diff --git a/site/content/docs/4.5/components/toasts.md b/site/content/docs/4.5/components/toasts.md index fd8ea06e87ed..73e8bc41d776 100644 --- a/site/content/docs/4.5/components/toasts.md +++ b/site/content/docs/4.5/components/toasts.md @@ -45,6 +45,50 @@ Toasts are as flexible as you need and have very little required markup. At a mi {{< /example >}} +### Live + +Click the button the below to show as toast (positioning with our utilities in the lower right corner) that has been hidden by default with `.hide`. + +
+ +
+ +
+ +
+ +```html + + +
+ +
+``` + ### Translucent Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the `backdrop-filter` CSS property, we'll also attempt to blur the elements under a toast.