javascript - toastrjs - 悬停后更新计时器
问题描述
toastrjs
悬停后我找不到任何正确的方法来更新计时器。我将 a 确定extendedTimeOut
为 0,toastr
当我将鼠标悬停在它上面时不关闭它。timeOut 的时间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"
});
解决方案
使用 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" />
推荐阅读
- javascript - 保存包含画布绘图的 html 画布背景图像
- python - 无法使用 for 循环从网站获取定义列表
- webpack - 如何在 Nativescript-Vue 中调试 webpack 'Executing webpack failed with exit code 0'
- javascript - 从 unpkg 导入 d3
- c# - CSV 阅读器不再工作...无需进行任何更改
- python - 我如何使用 python 在任何窗口上绘图
- html - 如何停止 laravel 错误(预期规则或选择器)
- spring - Liquibase 差异不适用于@SecondaryTable
- c++ - C++ 中的 n % m 和 n - m * (n / m) 表达式有什么区别吗?
- python - 如何在 Ubuntu 中删除 Python2?