ui.draggable的jquery ui错误(" destroy") [英] jquery ui error for ui.draggable("destroy")

查看:106
本文介绍了ui.draggable的jquery ui错误(" destroy")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将其放在容器上时,我想删除< div> 的拖动属性。但我得到一个错误对象#<对象>属性'可拖动'不是函数,对于我的代码如下。

I want to remove the drag property of a <div> when I drop it on a container. But I get an error "Property 'draggable' of object #<Object> is not a function", for my code below.

$( "#fighter1" ).draggable(); //fighter1 is the id of draggable object
$( "#fighter2" ).draggable();
$( "#fighter3" ).draggable();
$( "#fighter4" ).draggable();
$( "#fighter5" ).draggable();
$( "#fighter6" ).draggable();
$( "#dest" ).droppable({      //dest is the id of droppable object
   drop: function( event, ui ) {
      ui.draggable("destroy"); //I get error here.
   }
});

我使用的是jquery ui版本1.8.12

I use the jquery ui version 1.8.12

推荐答案

我使用setTimeout函数解决了这个问题:

I resolved this problem using setTimeout function:

setTimeout(function(a){a.draggable("destroy");},100,ui.draggable);

这篇关于ui.draggable的jquery ui错误(&quot; destroy&quot;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆