【问题标题】:toastrjs - renew timer after hoveringtoastrjs - 悬停后更新计时器
【发布时间】:2020-03-27 20:02:23
【问题描述】:

悬停后,我在toastrjs 中找不到任何正确的更新计时器的方法。 我将extendedTimeOut 确定为0,当我将鼠标悬停在toastr 上时不会关闭它。 toastr 的超时时间是 10000 毫秒,但是当我完成悬停时,toastr 会立即隐藏。 在我将鼠标悬停在toastr 10000 毫秒后显示它的正确方法是什么。

我的 toastr 属性示例:

const inboxToastr = toastr;
inboxToastr.info(data.bubbleData, title, {
    "tapToDismiss": false,
    "closeButton": true,
    "newestOnTop": false,
    "progressBar": false,
    "positionClass": "toast-bottom-left", //position
    "preventDuplicates": false,
    "onclick": null,
    "showDuration": "300",
    "hideDuration": "1000",
    "timeOut": "10000",
    "extendedTimeOut": "0",
    "hideEasing": "linear",
    "iconClass": "background-gray"
});

【问题讨论】:

    标签: javascript toastr


    【解决方案1】:

    使用 timeout 10000 和 extendedTimeOut 10000 以及其他默认选项似乎可以正常工作,10 秒后自动关闭,悬停时保持显示,悬停后 10 秒隐藏。

    $(function() {
      toastr.info("Title", 'Subtitle', {
        timeOut: 10000,
        extendedTimeOut: 10000,
        progressBar: true
      });
    });
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" />

    【讨论】:

    • 这对我不起作用。可能是因为这个参数在悬停时禁用关闭,而不是在悬停后关闭....
    猜你喜欢
    • 1970-01-01
    • 2014-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-04
    • 2015-12-06
    • 2013-03-24
    • 2015-05-31
    相关资源
    最近更新 更多