JSFiddle - React, Tailwind, and code Playground

by Ajsa Ferguson

HTML

<div class="mobile-nav">
<div class="menu-btn" id="menu-btn">
    <div></div>	<span></span>
	<span></span>
	<span></span>

</div>
<div class="responsive-menu">
    <div class="header-menu">
        <ul>
            <li><a href="#">Link 1</a></li>
            <li><a href="#">Link 2</a></li>
            <li><a href="#">Link 3</a></li>
            <li><a href="#">Link 4</a></li>
            <li><a href="#">Link 5</a></li>
            <li><a href="#">Link 6</a></li>
            <li><a href="#">Link 7</a></li>
            <li><a href="#">Link 8</a></li>
            <li><a href="#">Link 9</a></li>
            <li><a href="#">Link 10</a></li>
            <li><a href="#">Link 11</a></li>
            <li><a href="#">Link 12</a></li>
            <li><a href="#">Link 13</a></li>
            <li><a href="#">Link 14</a></li>
            <li><a href="#">Link 15</a></li>
        </ul>
    </div>
</div>
</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various...

CSS

.header-menu {
    width: 100%;
}
.header-menu li {
    background: url("images/arrow.png") no-repeat left center;
    height: 40px;
    margin: 0;
    padding-left: 15px;
    line-height: 40px;
    -webkit-transition:background-position .3s ease-in;
    -moz-transition:background-position .3s ease-in;
    -o-transition:background-position .3s ease-in;
    transition:background-position .3s ease-in;
}
.header-menu li:hover {
    background: rgba(31, 73, 125, 0.8) url("images/arrow-hover.png") no-repeat left center;
}
.header-menu li a {
    display: block;
    margin: 0 5px;
    font-size: 18px;
}
.header-menu .current-menu-item {
    background: rgba(31, 73, 125, 0.8) url("images/arrow-hover.png") no-repeat right center;
}

.mobile-nav {
	position: relative;
	display: block;
	width: 90%;
	margin: 0 auto;
}

.mobile-nav .menu-btn {
    position: fixed;
    -webkit-backface-visibility: hidden;
    top: 0;
    left: 20px;
    padding-right: 8px;
    margin-top: 10px;
    line-height: 1.2;
    font-size: 18px;
    font-weight: 200;
    vertical-align: middle;
    z-index: 999;
}
.menu-btn span {
    display: block;
    width: 30px;
    height: 4px;
    margin: 4px 0;
    background: rgb(255, 255, 255);
    -webkit-box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
    -moz-box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
    box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
    z-index: 999;
}
.responsive-menu {
    display: none;

}
.expand {
    display: block !important;
    position: fixed;
    -webkit-backface-visibility: hidden;
    top: 50px;
    left: 0;
    background: rgba(31, 73, 125, 0.8);
    width: 100%;
}

JavaScript

(function($) {
        var open;
        var menu = $('.responsive-menu');
	    $('.menu-btn').click(function () {
            if(!open) {
                if(menu.height() > $(window).height()) {
                    open = true;
                    menu.css({'bottom': '0px', 'overflow': 'auto'});
                    document.body.style.overflow = 'hidden';
                }
            } else {
                open = false;
                menu.css({'bottom': '', 'overflow': ''});
                document.body.style.overflow = '';
            }
	        menu.toggleClass('expand');
	    });
	})(jQuery);