You can use flexbox to keep div
fixed without having to do this in script
, the examples below use a div
as a resize control, only the first div
is resized by script
, div
follows automatically, as determined in flex
In the same column:
$(".topo").resizable({ //determina a div que será redimensionada
handleSelector: ".divisor-horizontal", //determina a div que servirá de controle
resizeWidth: false //desabilita o redimensionamento horizontal
});
.vertical {
display: flex;
flex-direction: column;
height: 500px;
border: 1px solid silver;
overflow: hidden;
}
.topo {
flex: 0 0 auto;
padding: 10px;
height: 100px;
width: 100%;
white-space: nowrap;
background: #838383;
color: white;
}
.divisor-horizontal {
flex: 0 0 auto;
height: 18px;
background:#535353;
cursor: row-resize;
}
.base {
flex: 1 1 auto;
padding: 10px;
min-height: 200px;
background: #eee;
}
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/RickStrahl/jquery-resizable/master/src/jquery-resizable.js"></script><divclass="vertical">
<div class="topo">
topo
</div>
<div class="divisor-horizontal">
</div>
<div class="base">
base
</div>
</div>
On the same line:
$(".esquerda").resizable({ //determina a div que será redimensionada
handleSelector: ".divisor", //determina a div que servirá de controle
resizeHeight: false //desabilita o redimensionamento vertical
});
.horizontal {
display: flex;
flex-direction: row;
border: 1px solid silver;
overflow: hidden;
}
.esquerda {
flex: 0 0 auto;
padding: 10px;
width: 200px;
min-height: 200px;
min-width: 100px;
max-width:80%;
white-space: nowrap;
background: #838383;
color: white;
}
.divisor {
flex: 0 0 auto;
width: 18px;
background:#535353;
min-height: 200px;
cursor: col-resize;
}
.direita {
flex: 1 1 auto;
padding: 10px;
width: 100%;
min-height: 200px;
min-width: 200px;
background: #eee;
}
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/RickStrahl/jquery-resizable/master/src/jquery-resizable.js"></script><divclass="horizontal">
<div class="esquerda">
Esquerda
</div>
<div class="divisor">
</div>
<div class="direita">
Direita
</div>
</div>