Blog Lab

Resizable Sidebar with (almost) Vanilla JavaScript

See the Pen Resizable Sidebar by Xingchen Hong (@Zodiase) on CodePen.0

I only used jQuery to help find proper outer-width and modify them, which could be easily replaced with a helper function. Same for lodash debouncing.

This is a very feature-lite demo but the concept should work for many scenarios, as long as there’s a container in flex mode and not wrapping content, then put the slider in that container along with the sub-containers being resized and make sure all children have proper flex settings to resize properly.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.