开发者

In jquery sortable UI,What can we get from the event function's parameters like ui and event?

开发者 https://www.devze.com 2023-02-15 09:31 出处:网络
I know we can get the current dragged element\'s id by ui.item.attr(\'id\') but what can we get from event parameter? 开发者_开发问答Could it like javascript, have event.target property?

I know we can get the current dragged element's id by ui.item.attr('id')

but what can we get from event parameter? 开发者_开发问答Could it like javascript, have event.target property?

or get anything else?


All callbacks receive two arguments: The original browser event and a prepared ui object, view below (if you name your second argument 'ui'), you can do:

ui.helper - the current helper element (most often a clone of the item)
ui.position - current position of the helper
ui.offset - current absolute position of the helper
ui.item - the current dragged element
ui.placeholder - the placeholder (if you defined one)
ui.sender - the sortable where the item comes from (only exists if you move from one connected list to another)

You can also get this info from the UI documentation. http://jqueryui.com/demos/sortable/


Inspect the object in Firebug or Chrome's Dev tools to see what information it provides.

Here's what I get in the stop event:

In jquery sortable UI,What can we get from the event function's parameters like ui and event?

And if you expand the originalEvent: a.Event node, there's the target that you are looking for: target: HTMLTableCellElement

0

精彩评论

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

关注公众号