Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 键控后禁用jQuery可拖动_Javascript_Jquery_Html_Jquery Ui - Fatal编程技术网

Javascript 键控后禁用jQuery可拖动

Javascript 键控后禁用jQuery可拖动,javascript,jquery,html,jquery-ui,Javascript,Jquery,Html,Jquery Ui,这是我的小提琴: 现在,这些框是可拖动的,但我希望在文本输入框中后,它们是不可拖动的 我一直在处理的jQuery: // tried 'disable', and just #sortable without li $("#sortable > li").draggable('destroy'); 完整代码: $('input').keyup(function() { filter(this); }); function filter(element) {

这是我的小提琴:

现在,这些框是可拖动的,但我希望在文本输入框中后,它们是不可拖动的

我一直在处理的jQuery:

    // tried 'disable', and just #sortable without li
    $("#sortable > li").draggable('destroy'); 
完整代码:

    $('input').keyup(function() {
filter(this);

});

function filter(element) {
var value = $(element).val();

$("#sortable > li").each(function () {
    if ($(this).text().toLowerCase().indexOf(value) > -1) {
        $(this).show();
        $(".number").show();
        $(".numberstwo").show();
         $("#sortable > li").draggable('destroy');     

        // $('#sortable').addClass("destory");


    } else {
        $(this).hide();
        $(".number").hide();
        $(".numberstwo").hide();
        $(".games").css( "padding-top", "40px"); 

    }
});
}
$(“#可排序”).sortable({
回复:对,
占位符:“虚线占位符”,
取消:'.已取消'/-1){
$(this.show();
$(“.number”).fadeOut();
$(“.numbers2”).fadeOut();

$(this).addClass('cancelled');//嗯。在本地或JSFIDLE中对我不起作用。还有其他建议吗?@edawg-'Sortable'您维护吗?是的,这很有效!但是有了keyup,它就不会再出现了。我会继续使用它,谢谢。
$("#sortable").sortable({
    revert: true,
    placeholder: "dashed-placeholder"  ,
    cancel: '.canceled' // <-----add this option
});
$("#sortable > li").each(function () {
    if ($(this).text().indexOf(value) > -1) {
        $(this).show();
        $(".number").fadeOut();
        $(".numberstwo").fadeOut();
        $(this).addClass('canceled'); // <---- add
    } else {
        $(this).hide();
        $(".number").show();
        $(".numberstwo").show();         
        $(this).removeClass('canceled');  // <---- add
    }
});