toastrプラグインなしで単純なtoastr(通知)機能を実装したいと思います。簡単なtoastr通知メッセージ
5秒後に最後に追加された要素の遷移クラスを削除したいと考えています。
var loadNotification = function(typeClass, message) {
var notification = {
typeClass: typeClass || 'alert-success',
message: message
};
var template = UTILS.getHandleBarTemplate('#template-notification');
var templateMarkup = template(notification);
$('.notifications-area').append(templateMarkup);
$('.notifications-area').find('.q-notifications').last().addClass('transitioned');
};
現在Implementaion:
新しい通知が追加される可能性があり、追加された最後の要素のクラスが常に削除されるため、最後の要素を削除することは予測できませんでした。そこで、通知ごとにIDを追加しました。特定の間隔の後にその要素を削除しました。 答えた:自分自身の質問:https://stackoverflow.com/a/44496961/6774615 –
@ TabraizAliどのように私はあなたがsetTimeoutのfuntionを必要とすると仮定された –
ありがとう@Dineshこれに答えるために。私が解決策に到着するのを助けた –