From 123b2c4a405dd9e7273ef1e9576dbdf6a25e0869 Mon Sep 17 00:00:00 2001 From: oliveira131 <47257731+oliveira131@users.noreply.github.com> Date: Mon, 22 Jul 2019 00:50:13 -0300 Subject: [PATCH] Add prepend option Add prepend option to permit the new toasts inserted in reverse order. --- js/toast.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/toast.js b/js/toast.js index e8befb2..a80362f 100644 --- a/js/toast.js +++ b/js/toast.js @@ -39,6 +39,7 @@ ico = opts.ico, pause_on_hover = opts.pause_on_hover || false, pause = false, + prepend = opts.prepend, delay_or_autohide = ''; switch (type) { @@ -154,8 +155,13 @@ html += ''; - toast_wrapper.append(html); - toast_wrapper.find('.toast:last').toast('show'); + if(prepend === true){ + toast_wrapper.prepend(html); + toast_wrapper.find('.toast:first').toast('show'); + } else { + toast_wrapper.append(html); + toast_wrapper.find('.toast:last').toast('show'); + } if (pause_on_hover !== false) { setTimeout(function () {