使用toastr在屏幕上显示我的FCM弹出窗口。通知有不同的种类(成功,信息等)-如何定位当前触发的特定元素?
这是我的代码:
// Handle incoming messages
messaging.onMessage(function(payload) {
console.log("Notification received: ", payload);
toastr["success"](payload.notification.body, payload.notification.title, {
"closeButton": true,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-left",
"preventDuplicates": false,
"showDuration": 30000,
"hideDuration": 1000,
"timeOut": 0,
"extendedTimeOut": 0,
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
});
});
答案 0 :(得分:1)
我是否正确想您要获得最后的吐司?
如果吐司仍然存在于DOM中,那么它将获得仍在屏幕上的最新生成的吐司
$('.toast').last();