工具提示定位和隐藏工具提示在鼠标移出后立即

tooltip positionining and hiding tooltip immedately after mouse is moved out

本文关键字:工具提示 移出 定位 隐藏 鼠标      更新时间:2023-09-26

我正在使用jquery API来显示工具提示。我想将鼠标悬停在表格中的图像上时将工具提示放置在图像附近,当我将鼠标悬停在图像上时,以前的工具提示是仍然可以看到,一旦鼠标从图像上移开,我可以立即淡出工具提示吗?请找到小提琴:http://jsfiddle.net/0w9yo8x6/4/下面是代码片段:

$(function () {
    $(document).tooltip({
        content: function () {
            return $(this).prop('title');
        },
        show: null, 
        close: function (event, ui) {
            ui.tooltip.hover(
            function () {
                $(this).stop(true).fadeTo(400, 1);
            },
            function () {
                $(this).fadeOut("400", function () {
                    $(this).remove();
                })
            });
        }
    });
});
$(function () {
  $('.one').attr('title', $('.tooltipTable').remove().html());
  $(document).tooltip();
});
$(function () {
      $('.one').attr('title', $('.tooltipTable').remove().html());
      $(document).tooltip();
    });

无需实现自己的"close"函数,您只需在创建工具提示时将showhide属性设置为false即可。

查看文档显示/隐藏

$(document).tooltip({
    content: function () {
        return $(this).prop('title');
    },
    show: false,
    hide: false
});