tyroOfJava 2010-06-01 12:32
浏览 266
已采纳

jQuery的droppable的hoverClass的回调函数参数的问题

导入
[code="java"]

[/code]
然后有如下代码
[code="java"]
$('elementId').droppable({
accept: ".file, .folder",
hoverClass: function(e, ui) {
alert(typeof(ui));
alert(ui.helper);
}
}
[/code]
这里alert(typeof(ui))出的type居然是string。alert(ui.helper)居然是undefined。
按照jQuery UI的文档[code="java"]All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):

* ui.draggable - current draggable element, a jQuery object.
* ui.helper - current draggable helper, a jQuery object
* ui.position - current position of the draggable helper { top: , left: }
* ui.offset - current absolute position of the draggable helper { top: , left: }

[/code]
不应该这样吧。或者还是我用的不对?
怎样才能向hoverClass的回调函数传递自己需要的参数呢?

  • 写回答

6条回答 默认 最新

  • myali88 2010-06-02 10:11
    关注

    [quote]
    [code="javascript"]
    $('#block').arrt("cond", tree);// 这样添加?好像不行啊
    [/code]
    [/quote]
    你写错了,是“attr”。另外,直接绑定对象到DOM节点上设置属性只能字符串值。你可以把你的TreeClass分解成多个字符串值属性,绑定到节点上。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog