jQuery可拖动时显示qtip而被拖动 [英] Jquery draggable show qtip while being dragged
本文介绍了jQuery可拖动时显示qtip而被拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在拖动元素时在其上显示太尖,而在拖放/还原该元素时将其隐藏.
我正在使用qtip2作为工具提示
I want to show tootip on an element when it is being dragged and hide it when the element is dropped/reverted.
I am using qtip2 for the tooltip
我的代码:
$(".noDrop").qtip({
content: "You cannot drop this item",
show: "mousedown",
position: {
target: 'mouse',
viewport: $(window) // Keep it on-screen at all times if possible
},
hide: {
fixed: true, // Helps to prevent the tooltip from hiding ocassionally when tracking!
event: 'mouseup'
}
});
这是小提琴: http://jsfiddle.net/e6dJq/
单击该元素时,我可以看到工具提示,但是拖动开始后,它就会被隐藏.因为创建了克隆并且元素失去了焦点.
在释放鼠标单击之前,我无法保持工具提示可见.请帮忙.
I can see the tooltip when the element is clicked, but it is hidden as soon as the dragging starts. Because a clone is created and the element loses focus.
I am not able to keep the tooltip visible until the mouse click is released. Please help.
推荐答案
尝试如下:
$( ".noDrop" ).on( "dragstart", function( event, ui ) {
$(".ui-draggable-dragging").qtip(
content: "You cannot drop this item",
position: {
target: 'mouse',
viewport: $(window) // Keep it on-screen at all times if possible
},
hide: {
fixed: true, // Helps to prevent the tooltip from hiding ocassionally when tracking!
event: 'mouseup'
}
}).qtip("show");
});
它将在克隆的元素上调用qtip.
It will call qtip on cloned element.
这篇关于jQuery可拖动时显示qtip而被拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文