所以我想以下行爲進行qtip的:使qtip消失馬上
的qtip應顯示當我點擊的對象(我得到了這個工作沒有問題)......但後來我想有它會在數毫秒後消失,而不需要我做任何事情....你如何配置qtip來做到這一點?
我試圖
hide: {
when : 'inactive',
delay : 100,
fixed: false
}
,但它不工作....
任何幫助,將不勝感激...謝謝
所以我想以下行爲進行qtip的:使qtip消失馬上
的qtip應顯示當我點擊的對象(我得到了這個工作沒有問題)......但後來我想有它會在數毫秒後消失,而不需要我做任何事情....你如何配置qtip來做到這一點?
我試圖
hide: {
when : 'inactive',
delay : 100,
fixed: false
}
,但它不工作....
任何幫助,將不勝感激...謝謝
如果只想工具提示在屏幕上閃爍:
$(".tooltip").qtip({
content: "Test tooltip",
api: {
// As soon as the qtip is fully visible..
onShow: function (event) {
// Keep a reference to the qtip..
that = this;
// After 1ms (to let things settle down)
setTimeout(function() {
// Hide the qtip
that.hide();
}, 1); // change this value to have it stay on screen longer
}
},
show: "mouseover"
});
我覺得你的代碼是正確的,但delay
造成問題。 100ms只有0.1秒,所以也許qtip的渲染時間比這個時間要長,當它被告知要隱藏自己時(只是一個猜測),它不會存在。
我會增加延遲(你可能希望你的用戶看幾秒鐘的提示),看看是否有幫助。下面是一個使用1000ms的一個例子:http://jsfiddle.net/andrewwhitaker/dVEYq/
我知道這是一個老問題,但以防萬一有人經過,以正確的方式做它在qTip2中是:(事件而不是api)
events: {
show: function(event, api){
var that = this;
setTimeout(function() {
// Hide the qtip
that.hide();
}, 3000); // change this value to have it stay on screen longer
}
}
應該是$(that).hide(); – 2014-07-04 19:09:33