이 당신의 .layer { position: absolute; }
에서 온다.
절대 위치를 사용하는 경우 부모 위치에 항상 상대 위치를 설정해야합니다. 그렇지 않으면 많은 문제가 발생할 수 있습니다. 귀하의 경우에는
, 그냥이 CSS를 추가
.layers_group {
position: relative;
}
예 :
$(function() {
$(".live_resizable").resizable();
$(".live_draggable").draggable();
});
.main {
position:absolute;
right:25px;
left: 25px;
top: 25px;
bottom: 25px; /*200*/
overflow:auto;
border:2px solid red;
}
.layers_group {
position: relative;
}
#stuff {
width: 600px;
}
.layer {
background-color: green;
width: 100px;
height: 100px;
top: 900px;
left: 900px;
cursor:move;
}
/* Jquery to add hangles i think */
.ui-resizable { position: absolute;}
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; background:url(images/corner.gif); }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<link href="https://code.jquery.com/ui/1.8.18/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<script src="https://code.jquery.com/ui/1.8.18/jquery-ui.min.js"></script>
<div class="main">
<div id="stuff">
<div class="layers_group aaasdasd">
<div class="live_draggable live_resizable layer"></div>
</div>
</div>
</div>
내가 문제를 재현 할 수 있습니다. 녹색 상자를 오버플로없이 모서리로 드래그 한 다음 첫 번째 이미지에 표시하는 것처럼 크기를 조정하면 빨강 상자 바깥 쪽에서도 크기가 올바르게 조정됩니다. – Alvaro
Ok, 아마도 문제를 잘못 설명했습니다.이 URL로 이동 : http://jsfiddle.net/JTTYM/52/ 스크롤하여 녹색 상자를 찾은 다음 크기를 조정하십시오. 크기가 조절되면 오버플로 스크롤 막대가 사라집니다. 위에서 말했듯이 오버플로 값은 크기 조정시 계산되지 않습니다. – Kivylius