开发者

HTML layout is lost

I'm using jQuery 1.4 and jQuery UI sortable, my problem that i have two sortable implementations in the same page.

This is the one that works:

catlst.sortable({
handle:'div.ordenador',
update: function(event,ui) {
   var nx = ui.item.next();
   var pr = ui.item.prev();
   var im = ui.item;
   var catid = im.parent().parent().attr('catid');
   var direc = nx && 开发者_如何学Gonx.text() ? 'antes' : 'despues';
   $.post('curso/ordenar',
     'tipo='+catid+
     '&id='+im.attr('actividad_id')+
     '&direc='+direc+
     '&refid='+(direc=='antes'?nx.attr('actividad_id'):pr.attr('actividad_id')),null);
   }
});

It can sort successfully, but the second one:

    $('#clases').sortable({
    handle: 'div.ordenador-carpeta',
    axis: 'y',
    update: function(event,ui) {
        var nx = ui.item.next();
        var pr = ui.item.prev();
        var im = ui.item;
        var direc = nx && nx.text() ? 'antes' : 'despues';
    }
});

In both cases, #clases and 'catlst' are divs, that has only divs inside.

Second code simply doesn't work, i can drag but drop, the page layout get lost like if it were just removed and page reloaded.

Plus, Firebug gives me this error: attempt to run compile-and-go script on a cleared scope jquery.ui.js Line 178

This is driving me crazy, should i give more info?


The problem was a <script>document.write...</script> inside sortables items. So every time they changed its position, document.write used to work and ruin the page, I know it's not a good a idea to use it, in fact I'm removing them from my js.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜