5
我正在使用Raphael JS 2.0,並且想要模擬另一個元素上的拖動結束,然後刪除正在處理的當前元素。如果可以使用jquery來完成,那也會很棒。如何模擬Raphael JS中的拖動結束事件?
事情是這樣的:
var child = currentShift.data('endChild');
var newX = child.attr('x');
if (this !== currentShift)
{
newX = child.attr('x')-day;
}
currentShift.attr({y: child.attr('y'), x: newX, height: child.attr('height')});
$(currentShift.node).mouseup();
child.remove();
我得到的錯誤,因爲子元素是一拖的「移動」部分this
。但它被用於與currentShift
進行交互。
我知道還有一些獲得類似效果的其他方法,但我想知道是否有某種方法可以模擬任意元素的拖動結束。
可能是'var child = currentShift.data()。endChild;'...... –
@eicto我真的不明白你的意思。 'child'元素設置正確。我真正想知道的部分是'$(currentShift.node).mouseup();'。這條線實際上並沒有調用該元素的結束拖動事件,或者至少它給我提供了錯誤,而不是像我期望的那樣釋放currentShift元素。 – keyneom