jQuery.splitter() plug-in implements a two-pane resizable animated window, using existing DIV elements for layout.
Example 1
$("#splitterContainer").splitter({splitVertical:true,A:$('#leftPane'),B:$('#rightPane'),closeableto:0});
This will create a vertical splitter with toggle button
Example 2
$("#splitterContainer").splitter({minAsize:100,maxAsize:300,splitVertical:true,A:$('#leftPane'),B:$('#rightPane'),
slave:$("#rightSplitterContainer"),closeableto:0});
This will create a vertical splitter with toggle button, with minimum and maximum width for plane A and bind resize event to the slave element.
Add this script in the Head section :
<head>
<script type="text/javascript">
$(document).ready(function () {
$("#splitterContainer").splitter({ minAsize: 100, maxAsize: 300, splitVertical: true, A: $('#leftPane'), B: $('#rightPane'), slave: $("#rightSplitterContainer"), closeableto: 0 });
$("#rightSplitterContainer").splitter({ splitHorizontal: true, A: $('#rightTopPane'), B: $('#rightBottomPane'), closeableto: 100 });
});
</script>
</head>
Here is the HTML used:
<body>
<div id="splitterContainer">
<div id="leftPane">
<p>This pane limited to a range of 100 to 300 pixels wide with the minAsize / maxAsize
properties of the plugin..</p>
<p> </p>
</div>
<!-- #leftPane -->
<div id="rightPane">
<div style="height:5%;background:#bac8dc">Toolbar?</div>
<div id="rightSplitterContainer" style="height:95%">
<div id="rightTopPane"><p>testing</p> </div>
<!-- #rightTopPane-->
<div id="rightBottomPane">
<div><p>some content</p></div>
</div>
<!-- #rightBottomPane--></div>
<!-- #rightSplitterContainer--></div>
<!-- #rightPane --></div>
<!-- #splitterContainer -->
</body>
You can download the working sample application attached here.
Vikas SanapPosted Mar 24, 2020, 7:22 AM
Hi can u please share example where splitter has both right and left arrow buttons to collapse to both side?
Aleksandra NikolovaPosted Sep 13, 2016, 8:36 AM
Nice article, I use shieldui splitter control - you can see it in this link https://demos.shieldui.com/mvc/splitter/nested
Akshay DeshpandePosted May 13, 2013, 8:36 AM
I don't want to show anything in the left pane (Left splitt bar should not be shown) and only show the contents in the Right Top pane and Right Bottom pane with Horizontal split bar. Can we do this?
shimon bhPosted May 12, 2013, 3:26 AM
There is a problem with IE. The horizontal bar is not displayed and it looks like it has to do with CSS. looking into it reviled that the horizontal bar is displayed at the bottom of the page which is not visible because the vertical split bar pushes it down to the point where it ends. The vertical bar and the horizontal bar are one on top of the other and not one next to the other. any idea (CSS flow, inline block don't work...)
craig maasPosted Nov 29, 2012, 1:18 AM
awesome work ! THANK YOU.
Arfie TurnquistPosted Feb 4, 2011, 7:30 PM
It didn't work for in IE8 on Windows7 though. I used your simple code published here, and it threw an exception on page load. Here: A.show().css(opts.sizing,sizeA+'px'); I looked into it. This line produces a NaN : var barsize=C[opts.sizing]()+(2*parseInt(C.css('border-'+opts.moving+'-width')));//+ border. cehap&dirty The call to C.css('border-'+opts.moving+'-width') returns the string "medium", which is not a number. parseInt() on that string produces NaN, which gets propagated into sizeA, and eventually an exception is thrown by the call to: A.show().css(opts.sizing,sizeA+'px'); I tracked that down, and tried fixing it, but the splitter plugin still didn't work. It gave me just a jumbled display, and the splitter bar wasn't visible, although there was no exception. It works in your demo, but I think there is some CSS in your demo that is required in order for the splitter to work, yet not documented. Seems like your splitter.js function ought to add the required css implicitly, when the splitter is used. Maybe this thing needs more testing.
Mahesh ChandPosted Feb 3, 2011, 10:57 PM
Keep up the good work!