开发者

Adding a highlight animation when hovering a sortable object over a droppable object JQUERY

开发者 https://www.devze.com 2023-01-10 08:37 出处:网络
I have a list of objects called projects that are sortable, and a list of objects called categories that are droppable. I need to somehow make it so that when you click on a sortable project, and drag

I have a list of objects called projects that are sortable, and a list of objects called categories that are droppable. I need to somehow make it so that when you click on a sortable project, and drag it down so it is hove开发者_JAVA技巧ring over a droppable category, the category that the project is going to go into is highlighted, or outlined or some other kind of animation.

I am sure that it could be done by something as simple as an add-class-on-hover-over-droppable-object type function, but I don't know how it is supposed to be setup.

Looking through some of the jQuery documentation, I found out that for a droppable object, you can set an over: function(), attribute, but I couldn't get it to work...

What do I need to do to make this work?


Use the hoverClass option. One of the demos for jQuery droppable uses it (click on view source to view how it works).

$("#something").droppable({
    hoverClass: 'someClassName'
});
0

精彩评论

暂无评论...
验证码 换一张
取 消