Swipeable Hamburger Menu Concept with Vanilla JS

Swipeable hamburger menu concept with vanilla JS that allows users to toggle menu using scroll events in mobile view.

javascript swipe side menu, mobile web swipe gesture, swipe menu javascript, mobile web bottom navigation css, swipeable menu css, swipe scroll javascript

How to make use of it:

1. Create an off-canvas menu on the page.

<div id="hamburger-menu">
  <ul class="list">
    <li class="active"><a>Home</a></li>

2. Create a background overlay that appears when toggling off the panel.

<div id="hamburger-menu__bg"></div>

3. Create a hamburger toggle button to toggle navigation off the canvas.

<div id="hamburger-btn">

4. Basic CSS/CSS3 Styles.

.hamburger-drawer, #invis-drawer, #hamburger-menu, #hamburger-menu__bg {
  position: fixed;
  min-height: 100vh
#invis-drawer {
  width: 5%;
  background-color: #444
#hamburger-menu {
  width: 60%;
  background-color: #f1f1f1;
  z-index: 100;
  transform: translate3d(-100%, 0, 0)
#hamburger-menu::after {
  content: '';
  position: fixed;
  top: 0;
  right: -20px;
  width: 20px;
  min-height: 100vh
#hamburger-menu ul.list {
  list-style: none;
  padding: 0
#hamburger-menu ul.list li { padding: 15px }
#hamburger-menu ul.list li.active { background-color: rgba(0, 0, 0, 0.1) }
#hamburger-menu__bg {
  z-index: -1;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.5)
#hamburger-btn {
  position: relative;
  height: 22px;
  margin-left: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-around
#hamburger-btn span {
  width: 30px;
  height: 2px;
  background-color: #000

5. Main JavaScript to activate off-board navigation.

var hamburgerDrawer = document.getElementById('hamburger-menu');
var hamburgerBtn = document.getElementById('hamburger-btn');
var hamburgerDrawerBg = document.getElementById('hamburger-menu__bg');
var axisCords;
var hamburgerDrawerWidth = hamburgerDrawer.clientWidth;
var oneByForthScreen = window.innerWidth / 4;
var openStatus = false;
function drawToStart() {
      transform: `translate3d(${axisCords ? axisCords + 'px' : 0 + 'px'}, 0, 0)`
      transform: 'translate3d(-100%, 0, 0)'
  ], {
      duration: 500,
      easing: 'ease-in-out'
  hamburgerDrawer.style.transform = 'translate3d(-100%, 0, 0)';
  openStatus = false;
function drawToEnd() {
      transform: `translate3d(${axisCords ? axisCords + 'px' : -100 + '%'}, 0, 0)`
      transform: 'translate3d(0, 0, 0)'
  ], {
      duration: 500,
      easing: 'ease-in-out'
  hamburgerDrawer.style.transform = 'translate3d(0, 0, 0)';
  openStatus = true;
// Click on Menu Button to Drawer
hamburgerBtn.addEventListener('click', drawToEnd);
// Click on Background to Close
hamburgerDrawerBg.addEventListener('click', function(){
  if (openStatus) drawToStart();
  function(e) {
    axisCords = e.changedTouches[0].pageX - hamburgerDrawerWidth;
    if (axisCords > 0) axisCords = 0;
    this.style.transform = 'translate3d(' + axisCords + 'px, 0, 0)';
  function(e) {
    var endPoint = e.changedTouches[0].pageX;
    var isOverThreshold = endPoint > oneByForthScreen && endPoint < hamburgerDrawerWidth;
    if (endPoint < oneByForthScreen) {
    } else if (isOverThreshold) {
    } else {
      openStatus = true;
    axisCords = null;

swipeable off-canvas navigation, swipeable-hamburger Plugin/Github

See Demo And Download

Official Website(kaungmyatlwin): Click Here

This superior jQuery/javascript plugin is developed by kaungmyatlwin. For extra advanced usage, please go to the official website.

Related Posts


Responsive Image Gallery Lightbox jQuery Plugin | VenoBox

VenoBox is a responsive jQuery modal window plugin suitable for images, embedded content, iFrames, Google Maps, Vimeo, and YouTube videos. The big difference compared to many other…


[Animation] Bootstrap Multi-Level Responsive Dropdown Menu

Bootstrap-based multi-level dropdown navigation menu with cool animations. The dropdown on Hover is a jQuery plugin used to create Bootstrap multi-level scroll-triggered dropdown menus with CSS3 animations…


Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…


HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….


CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…


How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Leave a Reply

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