Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop List Items from jumping when using inline-block with JQuery draggable?

Just discovered the joys of JQuery's "draggable" API, but I want to display my list using inline-block. This makes the list items jump when you drag them, does anyone know how to fix this?

The code I'm using is:

   $(function() {
        $( "#sortable1, #sortable2" ).sortable({
            connectWith: ".connectedSortable"
        }).disableSelection();
    });​

http://jsfiddle.net/VVaqu/

like image 245
Daniel F. Dietzel Avatar asked Jan 14 '23 23:01

Daniel F. Dietzel


2 Answers

Another solution if you can't use float:

#sortable1 li, #sortable2 li{
    display: inline-block;
    vertical-align: top;
}

The vertical-align:top is important.

like image 79
shane Avatar answered Feb 14 '23 20:02

shane


Fiddle demo

Just add : float:left; to your li elements

#sortable1 li, #sortable2 li {
 float:left;
 /*other styles...*/
}
like image 39
Roko C. Buljan Avatar answered Feb 14 '23 19:02

Roko C. Buljan