每当我从#selAttr中拖动项目时,我就会在右侧出现一些空间,我不知道为什么?但是,当我拖动#unSelAttr表单时,一切都很好。我正在使用可排序的jQuery UI。

#selAttr {
            text-align: left;
            height: 200px;
            border: 1px solid #eee;
            width: 180px;
            min-width: 180px;
            min-height: 20px;
            list-style-type: none;
            padding: 0px;
            margin-left: 20px;
            overflow: auto ;
            overflow-x: hidden;
        }

        #unSelAttr {
            text-align: left;
            height: 200px;
            border: 1px solid #eee;
            width: 180px;
            min-width: 180px;
            min-height: 20px;
            list-style-type: none;
            padding: 0px;
            margin-left: 20px;
            overflow: auto ;
            overflow-x: hidden;
        }

  #keysModal {
            margin: 0px;
            padding: 0px;
            color: black;
            width: 500px;
            min-width: 500px;
            margin-left: 5px;
        }

 .modal-dialog {
            top: 100px;
            left: 10px;
            float: left;
            width: 430px;
            min-width: 430px;
            margin: 0px;
            padding: 0px;
            margin-left: 5px;

        }

 <div id="keysModal" class="modal fade"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 id="myModalLabel" class="modal-title" >List of Keys</h4>
            </div>
            <form id="keysForm" action="javascript:void(0)">
                <table>
                    <tr>
                        <td>
                            <ul id="selAttr" class="connectedSortable">
                            </ul>
                        </td>
                        <td>
                            <ul id="unSelAttr" class="connectedSortable">
                            </ul>
                        </td>
                    </tr>
                </table>
                <hr/>
                <button id="doneBtn" type="button" class="btn btn-success"  data-dismiss="modal">Done</button>
            </form>
        </div>
    </div>
</div>


在JS中,我有:

 $( "#selAttr, #unSelAttr" ).sortable({
    connectWith: ".connectedSortable",
    update: function(event, ui) {
        getActiveKeys();
        getNonActiveKeys();
        updateNonActiveKeys();
    }
}).disableSelection();

最佳答案

没关系,我解决了。万一其他人有同样的问题,我会贴出答案。我要做的就是增加到:

width: 185px


在#selAttr中。

10-04 16:52