jQuery UI可拖动并在拖动事件上添加类 [英] jQuery UI draggable and adding class on drag event
本文介绍了jQuery UI可拖动并在拖动事件上添加类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用jQuery UI将类添加到可拖动事件中.
I am trying to add a class to the draggable event using jQuery UI.
但是我编写的以下代码无法正常工作;
However the following code that I've written is not working as expected;
$(function () {
$('ul.sortable div.draggable').draggable({
start: function(event, ui) { ui.helper.addClass('move'); },
});
});
基本上,我试图在div.draggable中添加一个阴影(使用move类).拖动事件有效时我在做什么错,但是没有出现阴影?
Essentially I am trying to add a drop shadow (using the move class) to the div.draggable. What am I doing wrong as the drag event works, but the drop shadow does not appear?
先谢谢了.
推荐答案
.在拖动期间,该元素还会获得一类ui-draggable-dragging
. During drag the element also gets a class of ui-draggable-dragging
您可以只编写CSS来利用该类,而不是尝试添加一个类.
You could just write the CSS to leverage this class as opposed to trying to add a class.
这篇关于jQuery UI可拖动并在拖动事件上添加类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文