【问题标题】:Target specific toastr element目标特定的 toastr 元素
【发布时间】:2019-01-07 14:24:58
【问题描述】:

使用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"
       });  
});

【问题讨论】:

    标签: toastr


    【解决方案1】:

    我认为您想要生成最后一个 toast 是否正确?

    如果 toast 仍然存在于 DOM 中,那么这将获得最近生成的仍在屏幕上的 toast

    $('.toast').last();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-10
      • 2012-10-18
      • 2019-05-09
      • 1970-01-01
      • 1970-01-01
      • 2017-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多