istediğim Ne:3 ayarlanabilir div nasıl yaratırsınız?
| A | | B | | C |
^ ^
buna göre
| A | | B | | C |
Ne var sürgülü B
ve C
arasında ||
değil sol ve B
, A
sağ ve C
boyutlandırma olduğunu handles
taşıdığınızda B
yeniden boyutlandırılıyor, diğeri ise yeniden boyutlandırma imlecidir. Temel olarak C
bir perdedir ve A
ve B
'u kapsar. C
için çalışıyorum.
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>
burada onunla oynamaya Been:
| A | C |
Ben başkası kadar bu almak için gayet iyi kod kırdı Bir çözüm arıyordu
https://jsfiddle.net/ju9zb1he/5/
[Bu kullanışlı gelebilir] (http://gridster.net/ demos/resize-limits.html) – ODelibalta
Belirli bir çözüme mi ihtiyacınız var, yoksa bir eklenti mi? –
Bir eklenti değil, çözümü genelleme ve –