quello che voglio:Come si creano 3 immersioni regolabili?
| A | | B | | C |
^ ^
Quando si sposta il handles
sinistra e destra A
, B
, e C
ridimensionamento di conseguenza
| A | | B | | C |
Quello che ho è il ||
tra il B
e C
scorrevole, ma non il ridimensionamento B
e tutto quello che ottengo sull'altro è il cursore di ridimensionamento. Fondamentalmente C
è una tenda e copre A
e B
. Ho ottenuto dimensioni min lavorando per C
.
| A | C |
ho rotto qualcun altro è perfettamente buon codice per arrivare a questo punto:
var isResizing = false,
who='',
lastDownX = 0;
$(function() {
var container = $('#container'),
left = $('#left'),
right = $('#right'),
middle = $('#middle'),
hand2 = $('#hand2'),
handle = $('#handle');
handle.on('mousedown', function (e) {
isResizing = true;
who=e.target.id;
lastDownX = e.clientX;
});
$(document).on('mousemove', function (e) {
var temp, min;
// we don't want to do anything if we aren't resizing.
if (!isResizing)
return;
min=container.width() * 0.1;
temp = container.width() - (e.clientX - container.offset().left);
if (temp < min)
temp = min;
if (who == 'handle')
right.css('width', temp);
if (who == 'hand2')
left.css('width', temp);
}).on('mouseup', function (e) {
// stop resizing
isResizing = false;
});
});
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#container {
width: 100%;
height: 100%;
/* Disable selection so it doesn't get annoying when dragging. */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: moz-none;
-ms-user-select: none;
user-select: none;
}
#container #left {
width: 40%;
height: 100%;
float: left;
background: red;
}
#container #middle {
margin-left: 40%;
height: 100%;
background: green;
}
#container #right {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 200px;
background: rgba(0, 0, 255, 0.90);
}
#container #handle {
position: absolute;
left: -4px;
top: 0;
bottom: 0;
width: 80px;
cursor: w-resize;
}
#container #hand2 {
position: absolute;
left: 39%;
top: 0;
bottom: 0;
width: 80px;
cursor: w-resize;
}
<div id="container">
<!-- Left side -->
<div id="left"> This is the left side's content!</div>
<!-- middle -->
<div id="middle">
<div id="hand2"></div> This is the middle content!
</div>
<!-- Right side -->
<div id="right">
<!-- Actual resize handle -->
<div id="handle"></div> This is the right side's content!
</div>
</div>
giocato con lui qui: https://jsfiddle.net/ju9zb1he/5/
[Questo può tornare utile] (http://gridster.net/ demos/resize-limits.html) – ODelibalta
Hai bisogno di una soluzione specifica o un plug-in è benvenuto? –
Non è un plug-in, ma ho bisogno di generalizzare la soluzione e ottenere informazioni sufficienti per farlo. –