I dropped the jQuery.Layout plugin in favor of KendoUI’s Splitter control yesterday. Kendo’s Splitter is just so much easier to use and more flexible. It was a no-brainer for me, really.
But I ran in to a problem: how to resize the splitter so that the “main” content of my app would resize vertically, while keeping the header and footer at a set, specific size? Fortunately, Burke Holland came to my rescue! And, as I expected, it’s a simple solution.
Resize The Splitter On Window Resize
Simple enough, right? Just pay attention to the $(window).resize event, calculate the size of the main content area, and call resize on the splitter.
I did make a few small changes to the resize method from the original JSFiddle that I’m showing, in my gist above. In order to keep the top and bottom panes the same size all the time, I added a resize on them in the function. Otherwise, when you shrink the screen really small and then make it really large again, the top and bottom sections tend to be hidden. I also cleaned up a few global var leaks and fixed an error triggering the reset event for the version of Kendo I’m using.
Derick Bailey is a Developer Advocate for Kendo UI, a problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He has been a professional software developer since the late 90's, and has been writing code since the late 80's.
Find me on twitter:
@derickbailey,
@mutedsolutions,
@backbonejsclass
Find me on the web:
WatchMeCode (screencasts),
Kendo UI blog, MarionetteJS, My Github profile,
On Google+.