【问题标题】:Jquery drag and drop with css使用css进行jquery拖放
【发布时间】:2017-10-19 07:33:17
【问题描述】:

工作演示: http://jsfiddle.net/PWh2L/78/

$( ".droppable,.droppable1" ).sortable({
    connectWith: '.droppable,.droppable1',
    revert: 200,
    tolerance:'pointer',
    start: function(){

    },
    stop: function(event,ui){
    if ($(ui.item).hasClass('number1') && $(ui.item).parent()[0].id==="main_list" && $(ui.placeholder).parent()[0] != this) {

            $(this).sortable('cancel');

        }else if ($(ui.item).hasClass('number2') && $(ui.item).parent()[0].id=="main_list1" && $(ui.placeholder).parent()[0] != this){

            $(this).sortable('cancel');

        }
    },
    zIndex: 10
}).droppable({
    drop: function(ev, ui) {



     }
});

上面的链接是我的代码,我遇到了一个问题,就是当我将 element (testinggggg)B 拖到 C ,然后我尝试将元素(testingggg)C拖到A,然后它会自动回到C,但是当元素(testinggg)回到C时,它会在顶部修复它,我想要的是每个元素都回到C它会出现在Name:C下方,这意味着Name:C会将它固定在上面。

请指教。 :(

【问题讨论】:

    标签: javascript php jquery


    【解决方案1】:

    只需在 span 中添加 c

    <span class="curtem">C</span>
    

    这里是工作代码:http://jsfiddle.net/PWh2L/84/

    【讨论】:

    • Name: C 将能够拖放。我不希望它可以被拖动:(
    • 元素(testing)从B到C,那么元素(testing)就可以用Name:C拖动>
    猜你喜欢
    • 2010-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-12
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    相关资源
    最近更新 更多