From 6c069b697614a4ab9053c4f6d4a3aad75fbcaf97 Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Sun, 29 Nov 2020 15:58:44 +0100 Subject: [PATCH] Add interactive positioning widget --- site/assets/js/application.js | 11 ++++++ site/content/docs/5.0/components/toasts.md | 44 +++++++++++++++------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/site/assets/js/application.js b/site/assets/js/application.js index 58f4e23bf2..7f6752d2cd 100644 --- a/site/assets/js/application.js +++ b/site/assets/js/application.js @@ -28,6 +28,17 @@ new bootstrap.Popover(popover) }) + var toastPlacement = document.getElementById('toastPlacement') + if (toastPlacement) { + document.getElementById('selectToastPlacement').addEventListener('change', function () { + if (!toastPlacement.dataset.originalClass) { + toastPlacement.dataset.originalClass = toastPlacement.className + } + + toastPlacement.className = toastPlacement.dataset.originalClass + ' ' + this.value + }) + } + document.querySelectorAll('.toast') .forEach(function (toastNode) { var toast = new bootstrap.Toast(toastNode, { diff --git a/site/content/docs/5.0/components/toasts.md b/site/content/docs/5.0/components/toasts.md index ecee0ecdf4..740a926f95 100644 --- a/site/content/docs/5.0/components/toasts.md +++ b/site/content/docs/5.0/components/toasts.md @@ -135,17 +135,35 @@ Building on the above example, you can create different toast color schemes with Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you're only ever going to show one toast at a time, put the positioning styles right on the `.toast`. -{{< example class="bg-dark bd-example-toasts p-0">}} -
-
-
- {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} - Bootstrap - 11 mins ago - -
-
- Hello, world! This is a toast message. +{{< example >}} +
+
+ + +
+
+
+
+
+
+ {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} + Bootstrap + 11 mins ago +
+
+ Hello, world! This is a toast message. +
@@ -158,8 +176,8 @@ For systems that generate more notifications, consider using a wrapping element - -
+ +