這裏是我的腳本:如何在拖動時更改可排序元素的樣式?
<script>
$(function() {
t1 = window.performance.now()
var $sortable1 = $("#dragableElement").sortable({
connectWith: ".connectedSortable",
items: ".sorting-initialize",
containment: "window"
});
$sortable1.find(".ui-state-default").one("mouseenter",function(){
$(this).addClass("sorting-initialize");
$sortable1.sortable('refresh');
});
t2 = window.performance.now()
console.log(t2-t1)
});
</script>
是否有可能改變拖動項目的風格在這個腳本?例如添加背景:「黃色」,它會改變顏色等。
當我將這些開始和停止函數添加到我的代碼中時,拖放就消失了。任何想法爲什麼?當我評論這些行時,一切都很好。 –
@TitasKurtinaitis你能更新你的代碼嗎? –
並確保你有',''在包含後面:「窗口」'它應該是'containment:「window」,' –