-->

jQuery的如何的liveQuery翻译成吗?(jQuery how to translate l

2019-09-22 06:38发布

我有这样的代码,但是工作它使用的是旧的遗留功能“的liveQuery”,这确实应该切换到使用“上”。 然而,对于我的生活,我不能得到这个工作。 这里是我的代码片段。

jQuery('.box').livequery(function(){
     jQuery('a', this).click(function() {
          return false;
     });
     jQuery(this).draggable({
        appendTo: "body",
        helper: 'clone',
        opacity: 0.5,
        zIndex: 900,
        stop: function(event, ui) {
        return true;
        }           
     });
});

我想这...

jQuery('.box').on('draggable', function(){
     jQuery('a', this).click(function() {
          return false;
     });
     jQuery(this).draggable({
        appendTo: "body",
        helper: 'clone',
        opacity: 0.5,
        zIndex: 900,
        stop: function(event, ui) {
        return true;
        }           
     });
});

因为我猜“拖动”没有工作不是事件名称...

谢谢..

Answer 1:

这个答案在那里新插入的DOM节点可以帮助你在你的代码转换成在功能上,而不是活的功能



文章来源: jQuery how to translate livequery to on?