Please, enter a valid email!
00 days
00 hours
00 minutes
00 seconds

How to Build a jQuery Slide Out Menu with CSS

In this tutorial we’ll show you how to build a slide-out navigation menu. jQuery slide out menu is a common trend in modern web design, and you can see that many websites prefer that type of menu. It removes clutter from the page, and makes it more readable, allowing you to put all the emphasis on the content.

It's a great way to achieve minimalist layout for your site that would be free from distractions. Today I’ll show you how to build such a menu on your own by using:

  1. CSS & jQuery - requires at least basic knowledge of coding;
  2. JetMenu - a WordPress plugin for visual drag-and-drop customization.

Building a jQuery Slide Out Menu Using CSS

In order to build the navigation menu, let's take a look at the document set-up first:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Animation Menu Demo</title>
    <link rel="stylesheet" href="">
    <link href='' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <script src="script.js"></script>
    <link rel="stylesheet" href="style.css">
    <!-- Content goes here -->

First off, we’re loading Normalize.css in order to change the default browser styles, and make sure that our menu looks the same in every browser. We’re using FontAwesome to display an arrow in front of the menu item with sub-items. We also load jQuery to toggle the classes in the menu, and move all the custom jQuery code to script.js. The last link is the main stylesheet for our project.

Demo | Download Source

Hamburger Button

A hamburger button is a common attribute of a website’s navigation. Quite often it is made with an icon font, such as FontAwesome, but in this tutorial I’d like to add some animation to it, so we’ll be building it from a scratch. Basically, our button is a span, containing three divs displayed as horizontal bars.

<span class="toggle-button">
     <div class="menu-bar menu-bar-top"></div>
     <div class="menu-bar menu-bar-middle"></div>
     <div class="menu-bar menu-bar-bottom"></div>

The styles look as follows:

.toggle-button {
  position: fixed;
  width: 44px;
  height: 40px;
  padding: 4px;
  transition: .25s;
  z-index: 15;
.toggle-button:hover {
  cursor: pointer;
.toggle-button .menu-bar {
  position: absolute;
  border-radius: 2px;
  width: 80%;
  transition: .5s;
.toggle-button .menu-bar-top {
  border: 4px solid #555;
  border-bottom: none;
  top: 0;
.toggle-button .menu-bar-middle {
  height: 4px;
  background-color: #555;
  margin-top: 7px;
  margin-bottom: 7px;
  top: 4px;
.toggle-button .menu-bar-bottom {
  border: 4px solid #555;
  border-top: none;
  top: 22px;
.button-open .menu-bar-top {
  transform: rotate(45deg) translate(8px, 8px);
  transition: .5s;
.button-open .menu-bar-middle {
  transform: translate(230px);
  transition: .1s ease-in;
  opacity: 0;
.button-open .menu-bar-bottom {
  transform: rotate(-45deg) translate(8px, -7px);
  transition: .5s;

The button has a fixed position, and doesn’t move when you scroll the page. It also has a z-index of 15, so that it always remains on top of other elements and overlaps them. The button consists of three bars. Each bar shares some styles with each other, so I moved them into the .menu-bar class. The rest of the styles are moved into separate classes. The “magic” happens when we add another class to the containing span, which is .button-open. We add it with the help of jQuery like this:

$(document).ready(function() {
  var $toggleButton = $('.toggle-button');
  $toggleButton.on('click', function() {

For those of you unfamiliar with jQuery, let me explain what is going on here. First, we initialize a variable called $toggleButton, which contains our button. We store it in a variable, so that JavaScript doesn’t need to search through our document and look for the button each time we click on it. Then we create an event listener that listens to the clicks being made on the button. Each time the button is clicked, the event listener fires the function toggleClass() that toggles the .button-open class.

When the .button-open class is added we can use it to change the way of how the elements are displayed. We’re using the CSS3 translate() and rotate() functions to make the top and bottom bars rotate to 45 degrees, and the middle bar drift to the right and disappear. You can play around with the button and change its properties in the Codepen demo:

jQuery Slide Out Navigation Menu

Now that we have our button created, let’s actually make it useful and create the menu that slides in and out when we click the button. Here’s how the markup of the menu looks like:

<div class="menu-wrap">
    <div class="menu-sidebar">
        <ul class="menu">
            <li><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Blog</a></li>
            <li class="menu-item-has-children"><a href="#">Click The Arrow</a>
                <span class="sidebar-menu-arrow"></span>
                <ul class="sub-menu">
                    <li><a href="#">Alignment</a></li>
                    <li><a href="#">Markup</a></li>
                    <li><a href="#">Comments</a></li>
            <li><a href="#">Courses</a></li>
            <li><a href="#">Get In Touch</a></li>

I won’t go in detail about each style for this menu, instead I’ll just focus on a few important points here. First of all it’s the div with .menu-wrap class. Look at its styles:

.menu-wrap {
    background-color: #6968AB;
    position: fixed;
    top: 0;
    height: 100%;
    width: 280px;
    margin-left: -280px;
    font-size: 1em;
    font-weight: 700;
    overflow: auto;
    transition: .25s;
    z-index: 10;

The position is fixed, so the menu stays always at the same place when the page is scrolled. The height 100% allows the menu to take up all the vertical space on the page. Notice that the margin-left is set to a negative number, which equals to the menu width. This makes the menu disappear from the viewport. In order to make it visible again, we create another class toggler with jQuery. Our JavaScript file would look like this:

$(document).ready(function() {
    var $toggleButton = $('.toggle-button'),
        $menuWrap = $('.menu-wrap');

    $toggleButton.on('click', function() {

We add another variable $menuWrap which contains the menu wrapper, and use the same event handler for the button we created earlier. Only this time we toggle two classes, one for the button, and one for the menu wrapper. The .menu-show class sets the left margin to 0, and adds some box shadow effect.

.menu-show {
    margin-left: 0;
    box-shadow: 4px 2px 15px 1px #B9ADAD;

Sub-Menu and Links

You might notice that one of the list items has the class .menu-item-has-children and contains a sub-menu. Also, right after the link, there’s a span with the class .sidebar-menu-arrow.

<li class="menu-item-has-children"><a href="#">Click The Arrow</a>
<span class="sidebar-menu-arrow"></span>
    <ul class="sub-menu">
    <!-- List items -->

The span has an ::after pseudo-element that contains a FontAwesome arrow. By default the sub-menu is hidden, and would be visible only if you click the arrow. Here’s how we do it with jQuery:

$(document).ready(function() {
    var $sidebarArrow = $('.sidebar-menu-arrow');
    $ {

When we click the arrow, a function is called, which targets the next element right after the span (in our case it’s the sub-menu), and makes it visible. The function we’re using is slideToggle. It makes an element appear and disappear using a sliding motion. The function in our example has one parameter, which is the animation duration.

Lastly, the menu items in our demo have a hover effect. It is created using an ::after pseudo-element. The code looks as follows:

.menu-sidebar li > a::after {
    content: "";
    display: block;
    height: 0.15em;
    position: absolute;
    top: 100%;
    width: 102%;
    left: 50%;
    transform: translate(-50%);
    background-image: linear-gradient(to right, transparent 50.3%, #FFFA3B 50.3%);
    transition: background-position .2s .1s ease-out;
    background-size: 200% auto;
.menu-sidebar li > a:hover::after {
    background-position: -100% 0;

The ::after pseudo-element contains an absolutely positioned block level element at the bottom of each link, with the height of 0.15em and a full width. In other words it’s our underline. What is special here is that we don’t just apply the background color to the line, we’re using the linear-gradient() function on the background image. Although this function is intended for making color gradients, we can make an abrupt color change by specifying the percentages.

.menu-sidebar li > a::after {
  background-image: linear-gradient(to right, transparent 50.3%, #FFFA3B 50.3%);

Here a half of the line is transparent, and another half is yellow. By making the background size 200% we double the width of our block, so that the transparent part takes up all the width of the link, and the other, yellow part, is moved to the left and we don’t see it. On hover we change the background position to -100%, which moves our double-sized line. The yellow part becomes visible, and the transparent part is now hidden.

Instead of the transparent part you can use any other color. This would create an illusion of the line filled up by another color, but in reality it’s just a two-colored line. You can also experiment with gradients, instead of making an abrupt color change like we did here.

Go ahead and take a look at what we’ve built. Each of the elements we examined separately act together as a whole. Also, feel free to download the source code for this tutorial and use it for your own projects.

Demo | Download Source

Building a jQuery Slide Out Menu Using JetMenu

For those who skipped the entire CSS & jQuery part because coding is way more complicated than you thought it would be, I have some great news. WordPress took care of non-professional users by creating multiple plugins for a more convenient drag-and-drop customization.

What you’ll need is a JetMenu plugin to create a convenient slide-out menu using Elementor live content builder. This means you can easily add Elementor models to menu items by just moving them with your mouse cursor.


Demo | Download

For regular users, this plugin is everything. Not only is its drag-and-drop customization easy and fast, but also diverse in menu designs. And don’t worry about the responsiveness of your slide-out menu - it will look awesome on all types of screens.

Take a look at this video and you’ll understand why JetMenu plugin is so easy to work with (not to say it’s not as confusing as messing with CSS & jQuery code):

JetMenu. Introduction

Finally, JetMenu is fully compatible with Avada, BeTheme, and Enfold WordPress themes, and other WordPress Elementor themes. It comes with a set of documentation and 24/7 support for you to contact the developers in case of any issue or questions.

If you have any questions let me know in the comments below.

Zemez Responsive Navbar JavaScript

Zemez Responsive Navbar JavaScript.

If you already have a working web resource or blog, sometimes its functionality needs to be updated with new features. In such a situation, it is rational to re-create an html website. But, it is much faster and more efficient to implement a ready-made block of program code - a script. Here when a JavaScript comes in.

Take advantage of a fully responsive Navbar JavaScript to enhance your website navigation. The vendor provides 8 beautiful layouts for you to select the most suitable option for your web resource. You will discover a number of megamenus and drop-down elements to choose from. The highly customizable interface will allow you to create a unique design.

More features:

  • Flexbox-based
  • Sticky navbar
  • SASS
  • Single code for all devices
  • Compatible with Bootstrap 4

Demo | Download

jQuery Slide Out Menu FAQ

What is a jQuery slide out navigation menu?

It is a navigation element that has an animation effect. It looks like a menu that smoothly slides out when the user hovers over it with a pointer.

What is the jQuery slide out navigation menu used for?

If the menu is hidden and shows off only when the user needs it – it makes the whole website space clearer. Massy websites reduce the user experience, so it is better to keep everything in an understandable order.

Why do I need a jQuery slide-out navigation menu?

Animation effects make the website look more dynamic and modern users love it. The animated menu will make your pages more visually appealing.

Read Also

Matthew Cain

I like to create websites from the ground up, coding them carefully with HTML and CSS. Sometimes even the best and professionally created templates need some coding tricks. And here is my Quora account.

Get more to your email

Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.

From was successfully send!
Server error. Please, try again later.

241 responses to “How to Build a jQuery Slide Out Menu with CSS”

  1. Nickspeni says:

    [url=]seroquel sleepiness[/url]

  2. Tedspeni says:

    [url=]prozac price[/url]

  3. Samspeni says:

    [url=]provigil generic price[/url]

  4. Amyspeni says:

    [url=]tetracycline 250mg capsules online[/url]

  5. Kiaspeni says:

    [url=]finasteride where can i buy[/url]

  6. Judyspeni says:

    [url=]online pharmacy for sale[/url]

  7. Miaspeni says:

    [url=]medicine furosemide 40 mg[/url]

  8. Denspeni says:

    [url=]zithromax capsules 250mg[/url]

  9. Judyspeni says:

    [url=]cialis prescription online canada[/url]

  10. Nickspeni says:

    [url=]cheap viagra from canada[/url]

  11. Evaspeni says:

    [url=]canada prescription viagra[/url]

  12. Teospeni says:

    [url=]viagra online cheap price[/url]

  13. Teospeni says:

    [url=]cheap real cialis[/url]

  14. Samspeni says:

    [url=]generic viagra coupon[/url]

  15. Denspeni says:

    [url=]cheap viagra for sale canada[/url]

  16. Alanspeni says:

    [url=]cialis brand name in india[/url]

  17. Judyspeni says:

    [url=]cialis australia cost[/url]

  18. Kiaspeni says:

    [url=]cialis otc[/url]

  19. Kimspeni says:

    [url=]cost of sildenafil 100mg tablets[/url]

  20. Annaspeni says:

    [url=]female viagra singapore[/url]

  21. Jackspeni says:

    [url=]viagra australia pharmacy[/url]

  22. Sfero says:

    It is really a great and useful piece of information. I’m glad that you simply shared this useful info with us. Please keep us up to date like this. Thanks for sharing

  23. Annaspeni says:

    [url=]budesonide prices pharmacy[/url]

  24. Suespeni says:

    [url=]canadian pharmacy viagra 100mg[/url]

  25. Kiaspeni says:

    [url=]vermox 500mg tablet price[/url]

  26. Nickspeni says:

    [url=]vermox from mexico[/url]

  27. Evaspeni says:

    [url=]prozac pill[/url]

  28. Zakspeni says:

    [url=]cheap medrol[/url]

  29. Eyespeni says:

    [url=]prescription motrin 800[/url]

  30. Monteunide says:

    [url=]erectile dysfunction treatment[/url]

  31. Kiaspeni says:

    [url=]best price for sildenafil 20 mg[/url]

  32. Jimspeni says:

    [url=]accutane 60 mg daily[/url]

  33. Annaspeni says:

    [url=]sildalis tablets[/url]

  34. Jimspeni says:

    [url=]trental cost india[/url]

  35. Paulspeni says:

    [url=]buying generic viagra[/url]

  36. RitPieva says:

    Vegas Crest Casino Go Bananas The site has a great Withdrawals process within 24 hours and the withdrawal limits at Lucky Days Casino are 4,000 EUR day, 16,000 EUR week, 50,000 EUR month. We already have countless players just like you who are winning real money playing all of their favourite casino games online right now. Being an online destination, we have the flexibility to offer hundreds of games, including some innovative new card games alongside tried and tested favourites like a Night With Cleo. We run a range of tournaments, promotional offers and regular bonuses to keep all of our players happy and excited to play. When you join CafГ© Casino online, you have the chance to participate in some of the most thrilling and highest paying casino classics available to play online. A. Bitcoin Casinos are a type of online casino that accept cryptocurrencies, such as BTC. partypoker Poker app is naturally available for any type of smartphone, whether you have an iPhone, Android phone, Blackberry or a Windows phone. We tested the app with an iPhone 8 with the latest update of iOS on it, and everything ran very smoothly. If you want to become a true poker beast like our own Beasts of Poker Pro Player Joni Jouhkimainen, also a partypoker Team Pro, your choice should be partypoker! I play on Poker Stars Lite Since it’s not Completely RNG with casuals bots & morons like WSOP You actually play with users around the world Отримайте РїРѕРІРЅРёР№ доступ РґРѕ турнірних квитків С– Р±РѕРЅСѓСЃС–РІ Р·С– СЃРІРѕРіРѕ облікового запису. РљСЂС–Рј того, РІ мобільному додатку також доступна захищена Р·Р° РІСЃС–РјР° стандартами безпеки функція «Касир» РІС–Рґ 888poker. Отже, РІРё матимете можливість робити поповнення та виводити гроші Р·Р° РґРѕРїРѕРјРѕРіРѕСЋ СЃРїРѕСЃРѕР±С–РІ оплати, СЏРєРёРј РІРё надаєте перевагу.

  37. Jimspeni says:

    [url=]augmentin 825 125 mg[/url]

  38. Amyspeni says:

    [url=]orlistat 120mg mexico[/url]

  39. Zakspeni says:

    [url=]tadalafil generic over the counter[/url]

  40. Samspeni says:

    [url=]viagra 100mg tablet buy online[/url]

  41. Jackspeni says:

    [url=]antabuse pills for sale[/url]

  42. Jasonspeni says:

    [url=]800 mg motrin[/url]

  43. Jimspeni says:

    [url=]vermox pharmacy[/url]

  44. Evaspeni says:

    [url=]price of baclofen[/url]

  45. Denspeni says:

    [url=]prednisolone 5mg without prescription[/url]

  46. Tedspeni says:

    [url=]levitra price australia[/url]

  47. Jimspeni says:

    [url=]propecia for sale canada[/url]

  48. Boospeni says:

    [url=]viagra pills online south africa[/url]

  49. Carlspeni says:

    [url=]how much is ivermectin[/url]

  50. Denspeni says:

    [url=]feldene capsule 20mg[/url]

  51. Ivyspeni says:

    [url=]buy cheap abilify[/url]

  52. Kiaspeni says:

    [url=]piroxicam 2mg[/url]

  53. Samspeni says:

    [url=]generic lasix 40 mg[/url]

  54. Jackspeni says:

    [url=]purchase cheap cialis soft tabs[/url]

  55. Samspeni says:

    [url=]generic cialis paypal[/url]

  56. Evaspeni says:

    [url=]generic viagra price[/url]

  57. Tedspeni says:

    [url=]best online viagra pharmacy[/url]

  58. Nickspeni says:

    [url=]online pharmacy cialis india[/url]

  59. Tedspeni says:

    [url=]cost of viagra[/url]

  60. Eyespeni says:

    [url=]lasix 20 mg[/url]

  61. Jasonspeni says:

    [url=]gabapentin cap 400mg[/url]

  62. Yonspeni says:

    [url=]how much does ivermectin cost[/url]

  63. how long does botox in bladder last

  64. Alanspeni says:

    [url=]buy tadalafil online[/url]

  65. Kimspeni says:

    [url=]cheap cialis prescription[/url]

  66. Yonspeni says:

    [url=]generic sildenafil 50mg[/url]

  67. Kiaspeni says:

    [url=]ivermectin price[/url]

  68. Judyspeni says:

    [url=]buy generic vardenafil[/url]

  69. Samspeni says:

    [url=]compare prices cialis[/url]

  70. Jackspeni says:

    [url=]ivermectin 4000[/url]

  71. botox for overactive bladder uk

  72. Denspeni says:

    [url=]viagra for sale cheap[/url]

  73. Amyspeni says:

    [url=]buy cialis 40 mg online[/url]

  74. Paulspeni says:

    [url=]cheap viagra soft tabs[/url]

  75. Chevrolet Yedek parça

  76. Ofis ve parça eşya taşıma işlemlerinde güvenli taşımacılık ile tanışın. Siz de evden eve ve şehirler arası nakliyat işlemlerinizde güvenilir bir firmadan hizmet alın.

  77. Türkiye’nin en başarılı şehir içi nakliyat fiması ile evden eve taşımacılık artık çok kolay. Parça eşya taşıma, ofis taşıma ve şehirler arası nakliyat işlemleriniz için kaliteden ödün vermeyin.

  78. Ugospeni says:

    [url=]how to buy cialis online in canada[/url]

  79. seo analiz google sıralama yarışması

  80. asian jewelry store rochester ny

  81. Ashspeni says:

    [url=]tadalis sx soft[/url]

  82. Soğuk sıkım zeytinyağı

  83. Zakspeni says:

    [url=]prescription viagra online canada[/url]

  84. fantastic publish, very informative. I ponder why the opposite specialists of this sector don’t understand this. You should continue your writing. I am sure, you’ve a huge readers’ base already!

  85. SEO Analiz Google Sıralama Yarışması

  86. Taitoem says:

    coupon for cialis cialis cost per pill

  87. botox says:

    botox botox near me botox before and after

  88. botox says:

    botox botox near me botox before and after

  89. botox says:

    botox botox near me botox before and after

  90. kko63e says:

    what is tadalafil used for generic tadalafil 20mg where to buy cialis canada

  91. download iphone instagram videos online

  92. ios free instagram story download

  93. Instagram profile picture download

  94. instagram full hd photo download

  95. unliblybozv says:

    zithromax without prescription

  96. unliblyglul says:

    plaquenil generic name antimalarial drugs hydroxychloroquine

  97. canadian pharmacy viagra & cialis cialis in egypt

  98. instagram profile picture downloader

  99. instagram iphone online post download

  100. instagram highlights without program download

  101. RrnbJoisp says:

    best online pharmacy for oxycodone ramesh rx pharmacy

  102. Michaelbaxia says:

    cialis dosage [url=]cialis tadalafil & dapoxetine[/url]

  103. how to download instagram quality reels

  104. DsnSheer says:

    how to get viagra without a doctor viagra commercial 2016

  105. descarga de imagen de computadora de instagram

  106. android ücretsiz instagram resim indirme

  107. RkkzJoisp says:

    medplus pharmacy store locator cheap scripts pharmacy

  108. Instagram privát fiók fotóletöltő oldala

  109. Instagram iPhone Online-Story-Download

  110. Google says:


    The time to read or pay a visit to the content material or websites we’ve linked to beneath.

  111. 100 free chinese dating sites

  112. Google says:


    Wonderful story, reckoned we could combine several unrelated information, nevertheless seriously worth taking a look, whoa did one particular discover about Mid East has got a lot more problerms at the same time.

  113. Google says:


    The time to study or stop by the content material or internet sites we’ve linked to below.

  114. says:

    […]Here are a number of the web-sites we advise for our visitors[…]

  115. Google says:


    Please visit the sites we comply with, which includes this one particular, because it represents our picks in the web.

  116. Backlink says:


    […]here are some links to sites that we link to simply because we think they are worth visiting[…]

  117. Google says:


    That could be the end of this write-up. Here you’ll come across some sites that we assume you’ll value, just click the hyperlinks.

  118. says:

    […]we prefer to honor quite a few other net internet sites around the internet, even if they aren’t linked to us, by linking to them. Underneath are some webpages really worth checking out[…]

  119. OnHax Me says:

    OnHax Me

    […]we like to honor many other web web pages on the internet, even if they aren’t linked to us, by linking to them. Below are some webpages really worth checking out[…]

  120. Zeeshan says:

    Your article is helpful. Nice work keep it up ?

  121. Anyways... says:

    The link to the demo is broken.

  122. Rohit says:


    Thank you so much for this. I was wondering if it would be possible to get this whole thing aligned to the right instead of the left. I’ve tried tweaking some of the options myself but its just so overwhelming that I dont think I can manage.

    Appreciate any help you can give!

Leave a Reply

Your email address will not be published. Required fields are marked *