Multi-Level Push Menu
Multi-Level Push Menu
Multi-Level Push Menu
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 1/7
10/28/2020 Multi-Level Push Menu
Today we want to share another menu experiment with you. For sure you are
familiar with the off-canvas navigation on mobile apps and the implementations
for responsive websites like the one by David Bushell. We tried to explore the
possibility of creating a nested multi-level menu, something that could be quite
useful for menus with lots of content (like navigations of online stores). The result
is a “push” menu that can (theoretically) contain infinite nested sub-menus.
When opening a sub-level, the whole navigation pushes the content more,
allowing a slice of the parent menu to be visible. Optionally, this slice can be
visible or not, in which case the sub-menu will simply cover its parent.
Working with nested structures is quite tricky because when we, for example,
move the parent then all children will of course move as well. So we are using a
couple of tricks that will maintain the right 3D translates for the sub-menus and
their children. The main idea is to increment the value for the translate so that we
guarantee that the sub-levels are not shown once we push everything a bit more
for showing the slices of the parents. This is of course not necessary in the case
where the sub-menu is covering the parent menu.
Please note that we are using 3D Transforms which only work in modern
browsers. You will find a fallback example for non-supporting browsers in the
end of the component.css file where we simply show the first level menu. The
same we do for the no JS case.
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 2/7
10/28/2020 Multi-Level Push Menu
<div class="mp-level">
<h2 class="icon icon-display">Devices</h2>
<ul>
<li class="icon icon-arrow-left">
<a class="icon icon-phone" href="#">Mobile Phon
<div class="mp-level">
<h2>Mobile Phones</h2>
<ul>
<li><a href="#">Super Smart Phone</a></li>
<li><a href="#">Thin Magic Mobile</a></li>
<li><a href="#">Performance Crusher</a></li
<li><a href="#">Futuristic Experience</a></
</ul>
</div>
</li>
<li class="icon icon-arrow-left">
<!-- ... -->
</li>
<li class="icon icon-arrow-left">
<!-- ... -->
</li>
</ul>
</div>
</li>
<li><!-- ... --></li>
<!-- ... -->
</ul>
</div>
</nav>
<!-- /mp-menu -->
…where each level is wrapped into a division with the class mp-level.
Normally, wecookies
Codrops uses wouldfor
have used fixed positioning
its advertisement foranalytics.
solutions and for a menu We of this
hopekind
you'rebut
ok since
with this, but you
there is quite an
canpeculiar “problem”
opt-out if you with
wish. Read ourthat (transforms
Privacy Policy andwill make
Cookie it behave
Policy. OK like
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 3/7
10/28/2020 Multi-Level Push Menu
an absolute positioned element), we’ll have to use absolute positioning which will
leave us with some unwanted behavior of the site (scrolling of menu and
dependence of document height). So we’ve used a little trick to avoid the menu
being scrollable or to be cut off if the site’s content is too short by using the
following page structure:
<div class="container">
<!-- Push Wrapper -->
<div class="mp-pusher" id="mp-pusher">
html,
body,
.container,
.scroller {
Codrops height:
uses cookies for its advertisement solutions and for analytics. We hope you're ok with this, but you
100%;
} can opt-out if you wish. Read our Privacy Policy and Cookie Policy. OK
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 4/7
10/28/2020 Multi-Level Push Menu
.scroller {
overflow-y: scroll;
}
.scroller,
.scroller-inner {
position: relative;
}
.container {
position: relative;
overflow: hidden;
background: #34495e;
}
This will allow the content to be scrolled when the menu is closed and it will also
make the menu being 100% of the window height. Basically, we are emulating
what fixed positioning would do here.
Codrops uses cookies for its advertisement solutions and for analytics. We hope you're ok with this, but you
can opt-out if you wish. Read our Privacy Policy and Cookie Policy. OK
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 5/7
10/28/2020 Multi-Level Push Menu
For the demos we are using the beautiful Linicons iconfont by Sergey Shmidt
created with the help of the IcoMoon app.
Mary Lou
http://www.codrops.com
Codrops uses cookies for its advertisement solutions and for analytics. We hope you're ok with this, but you
How to Build an Case Study: Chang Liu Draggable Menu with
can opt-out if you wish. Read our Privacy Policy and Cookie Policy. OK
Underwater-Style Portfolio V4 Image Grid Previews
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 6/7
10/28/2020 Multi-Level Push Menu
Codrops uses cookies for its advertisement solutions and for analytics. We hope you're ok with this, but you
can opt-out if you wish. Read our Privacy Policy and Cookie Policy. OK
https://tympanus.net/codrops/2013/08/13/multi-level-push-menu/ 7/7