JSFiddle - React, Tailwind, and code Playground

by lollero

HTML

<div id="wrapper">
    <div id="menu">dsfasd</div>
    <div id="main">
        <a href="#" class="menu-btn">Menu</a>
    </div>
</div>

SCSS

$menu-width: 300px;

html, body {
    margin: 0px;
    padding: 0px;
    height: 100%;
}

#wrapper {
    float: left;
    position: relative;
    left: -$menu-width;
    height: 100%;
}

#menu {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: $menu-width;
    background: #000;
    color: #fff;
}

#main {
    position: relative;
    left: $menu-width;
}

JavaScript

$('.menu-btn').on("click", function( e ) {

	e.preventDefault();

	$('#wrapper').animate({
    	left: 0
    });

});