我正在使用JQuery UI拖放我的項目。JQuery UI:在拖動開始時刪除可拖動克隆上的Bootstrap工具提示?
在可拖動的元素上,我有Bootstrap(3.x)工具提示。
將鼠標移動到可拖動的位置會顯示工具提示。
我希望在拖動開始時刪除/隱藏可拖動克隆上的工具提示。我經過考驗和測試,但沒有成功。
這是整個事情的jsfiddle設置。鏈接:http://jsfiddle.net/mddc/6md9h/18/
<div id="draggable" class="ui-widget-content">
<div data-toggle="tooltip" data-original-title="Tooltip to disappear when drag starts.">Drag me</div>
</div>
<div id="droppable" class="ui-widget-header">
<p>Drop here</p>
</div>
下面是javascript代碼:
$(function() {
$("#draggable").draggable({
start: function(event, ui) {
//this is what I hope to work, but not working!
$(ui.helper).find('[data-toggle="tooltip"]').tooltip('hide');
},
helper: 'clone',
revert: "invalid"
});
$("#droppable").droppable({
drop: function(event, ui) {
$(this)
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
}
});
$('[data-toggle="tooltip"]').tooltip({
'animation': true,
'placement': 'bottom'
});
});
感謝您的幫助!
謝謝!你是天才!如何找到這個解決方案?思考過程?我瀏覽了JQuery UI和Bootstrap文檔並進行了搜索。我還在我的帖子前閱讀了您的其他帖子。測試了很多東西,但無法得到它的工作。 – curious1
@ curious1謝謝:-)我發現它檢查DOM,我看到插件添加的元素;這有點不好意思,但「開發人員工具」永遠是我們的朋友:-) –
@ curious1我認爲現在沒關係 –