12
शॉपिंग कार्ट से आइटम को कैसे हटाया जाएगा?jquery draggable droppable हटा
स्वाभाविक रूप से आप आइटम को वापस खींच और छोड़ने में सक्षम होना चाहते हैं।
$(function() {
$("#catalog").accordion();
$("#catalog li").draggable({
appendTo: "body",
helper: "clone"
});
$("#cart ol").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
accept: ":not(.ui-sortable-helper)",
drop: function(event, ui) {
$(this).find(".placeholder").remove();
$("").text(ui.draggable.text()).appendTo(this);
}
}).sortable({
items: "li:not(.placeholder)",
sort: function() {
// gets added unintentionally by droppable interacting with sortable
// using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
$(this).removeClass("ui-state-default");
}
});
});
... टाई ... बहुत कुछ! यह एक ही मुद्दे के साथ बहुत से लोगों की मदद करने जा रहा है! – Spechal
ग्रेट उत्तर एंड्रयू, धन्यवाद। –
हाय एंड्रयू +1, क्या होगा यदि हम ड्रैग और ड्रॉप के बदले कार्ट में आइटम में एक करीबी बटन (करीबी दिखने वाला हाइपरलिंक) जोड़ना चाहते हैं? मुझे लगता है कि उस मामले में मुझे 'कैटलॉग li.droppable' फ़ंक्शन की आवश्यकता नहीं है। अपने कोड का उपयोग कर इसके बारे में कैसे जाना है? – aspiring