Hope this helps you.
http://jsfiddle.net/T4St6/82/
<div id="container"> <div id="left_panel"> left content! </div> <div id="right_panel"> <div id="drag"></div> right content! </div> </div>
CSS
body, html { width: 100%; height: 100%; margin: 0; padding: 0; } #container { width: 100%; height: 100%; } #left_panel { position: absolute; left: 0; top: 0; bottom: 0; right: 100px; background: grey; } #right_panel { position: absolute; right: 0; top: 0; bottom: 0; width: 200px; color:#fff; background: black; } #drag { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: w-resize; }
JQuery
var isResizing = false, lastDownX = 0; $(function () { var container = $('#container'), left = $('#left_panel'), right = $('#right_panel'), handle = $('#drag'); handle.on('mousedown', function (e) { isResizing = true; lastDownX = e.clientX; }); $(document).on('mousemove', function (e) {
source share