javascript - Jquery UI 可使用引导列进行排序 - 右手边缘下降将较低的行向下推

标签 javascript jquery css twitter-bootstrap-3 jquery-ui-sortable

我已经为使用 JQuery UI 1.12.1、JQuery 3.1.0 和 Bootstrap 3.3.7 创建了一个测试脚本。

我的工作几乎都离不开一个问题。我在下面创建了 fiddle

https://jsfiddle.net/woldsnewmedia/aLm44L8p/

问题是,当将一个 Div 拖过右侧边缘的一个 Div 时,所有内容都会跳下来。有人发现我哪里出错了吗?代码在这里:-

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="/scripts/css/bootstrap.min.css" /><!-- v3.3.7 -->
    <script type="text/javascript" src="/scripts/js/jquery-3.1.0.min.js"></script><!-- v3.1.0 -->
    <script type="text/javascript" src="/scripts/js/bootstrap.min.js"></script><!-- v3.3.7 -->
    <script type="text/javascript" src="/scripts/js/jquery-ui.js"></script><!-- v1.12.1 -->

  <style type="text/css">

    .dragdrop-placeholder {
        background-color:red;
        margin-top:18px!important;
        margin-left:15px!important;
    }

    .hnd1{
        height:200px;
        background-color:blue;
    }

  </style>

  <title></title>

<script type="text/javascript">

$( document ).ready(function() {

    $('.wrow1').sortable({

        connectWith: ".wdragdrop1",
        handle: ".wdragdrop1",
        placeholder: "dragdrop-placeholder",

        update: function (e, ui) { 
                var widget_ids = $(this).sortable('toArray').toString();
                console.log(widget_ids);
              },

        start: function(e, ui){
         ui.placeholder.width(ui.item.find('.wdragdrop1').width());
         ui.placeholder.height(ui.item.find('.wdragdrop1').height());
         ui.placeholder.addClass(ui.item.attr("class"));
        }

    });


});

</script>

</head>

<body>
  <div class="container">
    <div class="row wrow1">
        <div class="col-md-3 col-sm-3" id="1">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 1</h3>
            </div>

        </div>
        <div class="col-md-3 col-sm-3" id="2">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 2</h3>
            </div>

            </div>
        <div class="col-md-3 col-sm-3" id="3">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 3</h3>
            </div>

            </div>
        <div class="col-md-3 col-sm-3" id="4">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 4</h3>
            </div>

            </div>
        <div class="col-md-3 col-sm-3" id="5">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 5</h3>
            </div>

            </div>
        <div class="col-md-3 col-sm-3" id="6">

            <div class="wdragdrop1">
                <h3 class="hnd1">Box 6</h3>
            </div>

            </div>
    </div>
</div>


</body>

</html>

最佳答案

所有 col-**-# 每行总和应为 12。如果大于则下一个元素将转到下一行。

关于javascript - Jquery UI 可使用引导列进行排序 - 右手边缘下降将较低的行向下推,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49966094/

相关文章:

javascript - 更改登录屏幕的占位符文本

javascript - 点击导出 HTML 表格

javascript - 使用parent().show()方法不显示父div

javascript - 使用 jquery 自定义喜欢计数器

javascript - 此功能在 Firefox 中不起作用

javascript - 如何重新开始循环javascript循环

javascript - 在API中发出请求并计算结果

css - Angular2 如何更改 typescript 中 css 类的样式?

javascript - 如果未找到子字符串,则在文本中添加前导空格

javascript - 使用 JavaScript 确定网站是否在移动设备上响应