請幫幫我,我知道一般如何使用拖動和投擲的課程後恢復,但我不能找到一種方法來實現這一目標:更改拖動對象,並刪除它
我有一個大尺寸圖像,我需要拖放到一個div。 1)拖動時,我想使用小尺寸的圖像(我已經擁有它,只需要更改src),而不是在大尺寸圖像上移動。
2)一旦達到目標div,我想隱藏拖動的圖像並在原始位置再次顯示大尺寸圖像。
唯一的限制是:「回覆:無效」必須適用。
這是我的代碼:
$("#big_img").draggable({
revert: 'invalid',
drag : function(e, ui){
//Change big image with a small version of it
$(this).attr("src").replace("/Large/","/Small/"); //<--this do nothing
}
});
$("#target").droppable({
drop: function(e, ui) {
alert("was added"); //<-- no problem here.
//Restore the big_img
}
});
謝謝。
要居中鼠標光標,使用: $( 「#big_img」)拖動({ cursorAt:{左:20,頂:15}, 幫手:... }); 在我的情況下,小圖像是40x30,所以我想以x = 20,y = 15爲中心。 我希望這可以幫助某人。 :) – lepe 2010-02-04 06:32:18