Javascript 一段时间后如何隐藏qtip工具提示?

Javascript 一段时间后如何隐藏qtip工具提示?,javascript,jquery,Javascript,Jquery,我正在使用qtip()生成工具提示。现在我需要在按下按钮时显示工具提示,并隐藏工具提示,例如,当3秒钟过去时。我当前的代码不工作,工具提示有时会消失,有时会保留 var self = $("#email"); self.qtip({ content: error, tip: true, position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, style: 'error',

我正在使用qtip()生成工具提示。现在我需要在按下按钮时显示工具提示,并隐藏工具提示,例如,当3秒钟过去时。我当前的代码不工作,工具提示有时会消失,有时会保留

var self = $("#email");
self.qtip({
    content: error,
    tip: true,
    position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } },
    style: 'error',
    show: { when: false, ready: true },
    hide: { when: { event: 'mousemove' }, delay: 2000, effect: function () { self.qtip("destroy"); } }
});

@新手,但一个回应是整理代码,这可能就是问题所在。例如,将变量“self”的名称替换为“this”


你为什么要触发mousemove上的隐藏?为什么不使用mouseout呢?我试图避免在用户点击一些ajax链接后工具提示会在页面上浮动的情况。但我认为延迟不足以隐藏此工具提示,销毁工具提示需要效果,但由于某些原因,此功能在我的页面上不起作用,但在其他页面上也可以。捕捉mousemove事件不是有点暴力吗?如果用户不移动鼠标,这也不会起作用
$("#email").qtip( { 
   content: error, 
   tip: true,
   position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, 
   style: 'error',
   show: { when: false, ready: true }, 
   hide: { when: { event: 'mousemove' }, 
           delay: 2000, 
           effect: function() { $(this).qtip("destroy"); }
         }
});