开发者

jquery - draggable

I have a simple table and draggable div on this table's cells. How can I get the element dragged div stopped on. I ne开发者_如何学运维ed to do this without droppable plugin. Because there are a lot of cell and droppable cause performance decrease. Any help would be appreciated.


I have the answer to half of your problem... If you look at the Draggable docs, you'll see that start, drag and stop events are triggered.

$('.element').draggable({ 
        axis: 'y',
        containment:'parent',
        stop: function(event,ui) 
        {
            console.log(ui);
        }
});

If you use the stop event as above, inside that callback function you can access ui.offset to get the mouse coordinates where the drag ended. From there, I don't know how you could figure out which element those coordinates are 'on top of', though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜