str*_*rry 2 javascript jquery draggable jquery-ui-sortable resizable
我制作了一个可排序,可调整大小,可拖动,带有克隆的portlet,但是当我调整大小时,我遇到了一个bug.
我的剧本:
<script type="text/javascript">
$(function() {
$('#column1').draggable({
helper:'clone',
connectToSortable:'#sort',
handle:'.widget-head',
});
$('#sort').sortable({
handle:'.widget-head',
connectWith: "#sort",
out: function (e,ui) {
$("#sort").children().resizable({ axis: 'x',containment: 'parent',
resize:
function(event, ui)
{
ui.size.width = ui.originalSize.width;
}
});
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我发现问题与样式有关并且能够修复它.每次调整大小时,位置都会变为绝对位置,所以为了处理我正在使用它:
$('#sort').sortable({
handle:'.widget-head',
connectWith: "#sort",
out: function (e,ui) {
$("#sort").children().resizable({
axis: 'x',
containment: 'parent',
resize: function(event, ui) {
ui.size.width = ui.originalSize.width;
(ui.helper).css({'position': '', 'top': '0px'});
}
});
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3540 次 |
| 最近记录: |