如何检索与 jQueryUI 可排序列表的辅助方法相关的数据?
我正在使用 jQueryUI 1.8.14,我想了解如何使用与 jQueryUI 可排序列表:
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)
例如,如果我像下面一样运行alert(ui.position)
,
$jQ("#sortable").sortable({
update: function(event, ui) {
alert(ui.position)
}
});
我会收到如下警报消息:“[object Object]
”... <强>我怎样才能检查它对象(例如:为了检索位置值 - 即整数值)?
I am using jQueryUI 1.8.14 and I would like to understand how to use helper methods related to a jQueryUI sortable list:
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)
For example, if I run the alert(ui.position)
like the following
$jQ("#sortable").sortable({
update: function(event, ui) {
alert(ui.position)
}
});
I get an alert message like this: "[object Object]
"... how can I inspect that object (eg: in order to retrieve the position value - that is, an integer value)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 console.log ,然后你可以看到该对象包含什么:)
通过执行以下操作找到此内容:
console.log(ui.position);
结果:
Object { top=26, left =10}
Use console.log on it, then you can see what the object contains :)
Found this by doing:
console.log(ui.position);
Result:
Object { top=26, left=10}