該網站與動態內容的工具提示鏈接。我正在使用jquery UI Tooltip來顯示它們。我不希望每次用戶不小心將光標懸停在鏈接上時顯示工具提示。我只想顯示工具提示,只要它將光標在鏈接上延遲幾秒鐘。 它應該像在Gmail中一樣工作,當您將鼠標懸停在發件人姓名上時,您會看到關於他的信息(請參閱picture)。jQuery UI工具提示加載和延遲顯示
我需要提示,哪些用戶可以交互,所以我用這個代碼(感謝Antonimo https://stackoverflow.com/a/15014759/274417)
$(document).tooltip({
show: null, // show immediately
items: 'input',
hide: {
effect: "", // fadeOut
},
open: function(event, ui) {
ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast");
},
close: function(event, ui) {
ui.tooltip.hover(
function() {
$(this).stop(true).fadeTo(400, 1);
//.fadeIn("slow"); // doesn't work because of stop()
},
function() {
$(this).fadeOut("400", function(){ $(this).remove(); })
}
);
}
});
Example here(你可以看到,當鼠標懸停在與工具提示元素這一切混亂)
如何做得更好?使用timeOut?或者,也許我應該使用hoverIntent插件?但它將如何編碼?
你有沒有看問題的http://計算器。 com/questions/16465744/jquery-tooltip-with-delay-on-show – Arun
是的,不是我的情況,我想。 – Zhivago