What is it?

Prototype of interactive sidebar menu for Single Page Applications, inspired by this and similar dribble posts. This pen is proof of concept and it is not a finished product in any way.

How does it work?

There are three div elements in navigational menu. Each of theese divs has unordinary list in it.

I create event listener on click using jquery which calls function navCliked() in which I pass 3 arguments: what div to transfer list items, cliked item (as an object), and which list elements to transfer.

I could not figure how to properly keep order of elements while moving them, so I gave each element an ID and I sort moved list items according to IDs after appending elements to it. Sort function just works, found it on stackowerflow, and I have only a rough idea of what it does, but if it is not broke, don’t fix it.

There is also function adjustHeight() which extends "bottom" div to the bottom of the page after every menu click so no matter how many elements in bottom part of the menu it is always perfectly sized to end at the most bottom of the browser's viewport.

What's next?

I want to polish this sidebar and use it in future. I think this is gonna be fun, especially when combined with fade animations in transitions.

But what is even more exited than using this idea for me is seeng this pen used and enhanced by community, so you are welcome to tweet your forks to me @la_la_code

Have a good day!