mag*_*ker 6 javascript jquery-ui
我有一个非常简单的DIV元素,我正在尝试调整大小并水平拖动.它工作正常,但DIV元素的高度也由jQuery UI更改.我不明白为什么.
有人有想法吗?
JS代码:
$('.task')
.draggable({
axis: 'x'
})
.resizable({
containment: 'parent',
handles: 'e, w'
});
HTML代码:
<ul>
<li>
<div class="task status-green">
<span class="handle-move"></span>
</div>
</li>
</ul>
CSS代码:
li {
height: 20px;
line-height: 20px;
list-style: none;
}
.task {
height: 16px;
margin-top: 2px;
position: relative;
}
.task span {
display: block;
height: 16px;
position: absolute;
z-index: 10;
}
.task .handle-move {
bottom: 0;
cursor: move;
left: 10px;
right: 10px;
top: 0;
z-index:1;
}
.task .ui-resizable-handle {
background-color: pink;
cursor: e-resize;
height: 16px;
position: absolute;
width: 10px;
}
.task .ui-resizable-w {
left: 0;
}
.task .ui-resizable-e {
right: 0;
}
.status-green {
background-color: green;
}
小智 1
根据我的经验,可调整大小的函数无法尝试管理“box-sizing”css-property。尝试使用
box-sizing: border-box;
Run Code Online (Sandbox Code Playgroud)
或者制作一个用于填充物的内部容器。
| 归档时间: |
|
| 查看次数: |
959 次 |
| 最近记录: |