javascript - jQueryUI : restrict container height on drag and drop element

标签 javascript jquery css jquery-ui drag-and-drop

我已经使用 jquery UI 实现了拖放功能。

这是它的 js fiddle ( http://jsfiddle.net/metm0v0f/)。

当我将一个 div 从一个 div 放到另一个 div 时,我想限制高度的增加。我试图限制 css 类:

overflow-x: hidden;
overflow-y: hidden;

但它仍然在增加高度。谁能帮我固定容器尺寸?

最佳答案

只需将这两行添加到 dbContainer1、dbContainer2 类:

.dbContainer1 {
    width: 40%;
    float: left;
    border: dotted 1px red;
    /*add the following lines*/
    height:250px;
    overflow-y:scroll;
}
.dbContainer2 {
    width: 40%;
    float: left;
    border: dotted 1px green;
    /*add the following lines*/
    height:250px;
    overflow-y:scroll;
}

关于javascript - jQueryUI : restrict container height on drag and drop element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47966987/

相关文章:

javascript - 使用 qrcode.js OnClick 生成随机 QR 码

javascript 使用 Firefox/chrome 进行 WMI 查询?

javascript - 如何使用 jQuery 处理 "defile"文本?

javascript - jQuery:如何获取一组元素?

html - CSS选择第一个 child ,如果它是某个标签

javascript - 在 HTML5 中沿 Z 轴旋转 - 翻转卡片

javascript 现在和以后声明 var

javascript - 构建一个基本计算器

javascript canvas 重新缩放并在图像上绘图

css - 媒体查询不会在 iphone 4 和 iphone 5s 的旋转中更新