I'm trying to create a two-column slideable region with a drag-bar in the center, see this Fiddle: http://jsfiddle.net/W7tGj/2/
I'm trying to avoid adding jQ-UI to the mix, so any help would be appreciated. I feel like I'm missing something simple.
I'm trying to create a two-column slideable region with a drag-bar in the center, see this Fiddle: http://jsfiddle.net/W7tGj/2/
I'm trying to avoid adding jQ-UI to the mix, so any help would be appreciated. I feel like I'm missing something simple.
First : - add container div to check mousemove
<div id="content-div">
<div id="left-panel">f</div>
<div id="drag-bar">f</div>
<div id="right-panel">f</div>
</div>
Second : - add mousemove event into div container
var movebar = false;
$('#drag-bar').mousedown(function(e){
movebar = true;
});
$('#drag-bar').mouseup(function(e){
movebar = false;
});
$('#content-div').mousemove(function(e){
if(movebar)
{
var x = e.pageX;
$('#left-panel').css({'width': x+'px'});
$('#right-panel').css({'margin-left': (x+5)+'px'});
}
});
try it this way, http://jsfiddle.net/W7tGj/6/, although it still cannot support drag, it does do the right thing when mouse is down