Bootstrap 工具提示的定时隐藏不适用于快速光标移动

https://jsfiddle.net/d2gr1qu5/

在这个小提琴中,我有代码在 2 秒后隐藏位于 db.students.insert({ name: "Alice",year: NumberInt(2019),major: "History",gpa: 3,address: { city: "NYC",street: "33rd Street" } }) 内的 clc; clear all; import mlreportgen.report.* import mlreportgen.dom.* import mlreportgen.utils.* dataInput = webread('https://people.sc.fsu.edu/~jburkardt/data/csv/lead_shot.csv'); colIsnum = varfun(@isnumeric,dataInput,'OutputFormat','uniform'); table_data = dataInput; % keep original,more precise data table_data{:,colIsnum} = round(dataInput{:,colIsnum},2) rpt = mlreportgen.report.Report("Sliced Table",'pdf'); open(rpt); chapter = Chapter(); table = FormalTable(table_data); table.Border = 'Solid'; table.RowSep = 'Solid'; table.ColSep = 'Solid'; para = Paragraph(['Data table']); para.Style = {OuterMargin('0in','0in','12pt')}; para.FontSize = '10pt'; add(chapter,para) slicer = TableSlicer("Table",table,"MaxCols",4,"RepeatCols",1); totcols = slicer.MaxCols - slicer.RepeatCols; slices = slicer.slice(); for slice=slices str = sprintf('%d repeating column and up to %d more columns',... slicer.RepeatCols,totcols); para = Paragraph(str); para.Bold = true; add(chapter,para) add(chapter,slice.Table) end add(rpt,chapter) close(rpt) rptview(rpt) 上的 manual Bootstrap Tooltip。此外,我还一直手动将其隐藏在 <img> 上。

它在大多数情况下都有效,但如果您快速向内/向外移动鼠标光标,有时您会看到进入该区域时最初不显示工具提示的情况。问题的一个症状是某些东西会闪烁并立即消失。

<button>
lwtdxy 回答:Bootstrap 工具提示的定时隐藏不适用于快速光标移动

可能是 the timeout 起作用了。您可以在离开工具提示时禁用超时。我用全局 timeoutTooltip 变量做了一个快速而肮脏的解决方案:

var timeoutTooltip;

$("[rel=tooltip]").tooltip({
    trigger: 'manual',placement: 'bottom'
});

$("[rel=tooltip]").on("mouseenter",function () {
    console.log('TOOLTIP: Entered mouseeneter');
    var that = $(this)
    that.tooltip('show');
    timeoutTooltip = window.setTimeout(function () {
        that.tooltip('hide');
        console.log('TOOLTIP: Completed Hide after 2000');
    },2000);
});

$("[rel=tooltip]").on("mouseleave click",function () {
    $(this).tooltip('hide');
    window.clearTimeout(timeoutTooltip);
});

timeoutTooltip 用于在您离开工具提示时清除超时。我相信这可以更好地编码,但它似乎可以工作。

本文链接:https://www.f2er.com/995732.html

大家都在问