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">}} -