Skip to content

Instantly share code, notes, and snippets.

@coder618
Last active December 22, 2018 06:18
Show Gist options
  • Save coder618/74900745a07402514f82265b38afe471 to your computer and use it in GitHub Desktop.
Save coder618/74900745a07402514f82265b38afe471 to your computer and use it in GitHub Desktop.
Mobile navigation
/* JS */
$("li.menu-item-has-children > a").on("click", function(e){
e.preventDefault();
var c_item = $(this).siblings('ul')
c_item.toggleClass("d-block")
})
/* MOBILE SCSS */
.main-nav-mobile-container{
position: fixed;
z-index: 10001;
background: lavenderblush;
width: 350px;
padding: 20px 25px 20px 20px;
right: 0;
top: 0;
transition: all .25s ;
}
// ul
.main-nav-mobile-list{
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
li{
display: block;
width: 100%;
}
a{
padding: 0;
}
// ul
.dropdown-menu{
width: 100px;
padding: 0;
margin: 0;
list-style: none;
border: 0;
position: relative;
display: block;
background-color: #ccc;
width: calc(100% - 20px);
left: 20px;
}
// li
.menu-item-has-children{
position: relative;
}
// Caret
.dropdown-toggle:after{
display: none;
}
.menu-item-has-children{
>a{
position: relative;
&:after{
content: " ";
position: absolute;
right: 0;
top: 0;
width: 10px;
height: 10px;
background: red;
display: block;
border: 0;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment