jquery ui:$(this).data(“ui-draggable”)undefined

时间:2013-08-19 14:33:26

标签: jquery jquery-ui jquery-ui-draggable

我从firebug

收到此错误
$(this).data("ui-draggable") undefined

在这行draggable.js jquery文件中:

var t = $("body"), o = $(this).data("ui-draggable").options;

我不知道该怎么做:这是我非常简单的代码:

<?echo HTML::script('assets/scripts/jquery.ui.draggable.js'),PHP_EOL ?>
<div id="draggable"></div>

css:

#draggable{
    background-color: white;
    width: 107px !important;
    height: 52px !important;
    border: 1px solid rgb(190, 190, 190); 
    margin-top : -7px;
    margin-top: -10px;
    font-size:11px;
    text-align:center;  
}

和js:

$(function() {  
    $("#draggable").draggable();
});

加载脚本的行来自kohanna一个php框架并且工作得很好。我使用在此之前加载的其他jquery小部件,它们完美地工作。

有什么想法吗?谢谢!

编辑: - 之前添加了UI,否则我的其他jquery小部件将无法正常工作,draggable.js文件也会正确添加 - 我检查了控制台,这是指我的div:#draggable

编辑2:

<?echo HTML::script('http://s3.amazonaws.com/imgs3.plinga.de/general/shop/plingaShop.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/jquery.multiselect.min.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/jquery.multiselect.filter.min.js'),PHP_EOL ?>
<?echo HTML::style('assets/styles/jquery.multiselect.css'),PHP_EOL ?>
<?echo HTML::style('assets/styles/newshop.css'),PHP_EOL ?>
<?echo HTML::style('assets/styles/jquery.multiselect.filter.css'),PHP_EOL ?>
<?echo HTML::style('assets/styles/jquery.nailthumb.1.1.min.css'),PHP_EOL ?>
<?echo HTML::style('assets/scripts/jquery.nailthumb.1.1.min.js'),PHP_EOL ?>
<? if(I18n::$lang == 'de') echo HTML::script("assets/scripts/locale/jquery.multiselect.filter.de.js"),PHP_EOL ?>
<?echo HTML::script('assets/scripts/plugins/upload/jquery.ui.widget.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/plugins/upload/jquery.iframe-transport.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/plugins/upload/jquery.fileupload.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/shop/show.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/newshop/edit.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/jquery.ui.draggable.js'),PHP_EOL ?>
<?echo HTML::script('assets/scripts/jquery.ui.droppable.js'),PHP_EOL ?>

1 个答案:

答案 0 :(得分:0)

爱德华是对的。我忘了加入depedancies:

  • UI Core
  • 小工具厂
  • 鼠标互动

谢谢!