I'm working on mobile navigation bar with jQuery. I have a slight issue the jQuery works perfectly with the mobile navigation bar, but when I resize my screen to desktop the desktop navigation disappears.
jQuery(document).ready(function() {
jQuery(".navtoggle").click(function() {
jQuery(".nav-menu").slideToggle();
});
});
Mobile Breackpoints SASS
@include breakpoint(xxxs) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
margin: 20px 0px;
display: block;
}
}
}
@include breakpoint(xxs) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
height: auto;
margin: 20px 0px;
display: block;
}
}
}
@include breakpoint(xs) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
height: auto;
margin: 20px 0px;
display: block;
}
}
}
@include breakpoint(sm) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
height: auto;
margin: 20px 0px;
display: block;
}
}
}
@include breakpoint(table) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
height: auto;
margin: 20px 0px;
display: block;
}
}
}
@include breakpoint(md) {
header {
nav {
ul {
background: #6c49b8;
li {
display: block;
border-bottom: 1px solid rgba(0,0,0,.1);
border-left: none;
border-right: none;
padding: 15px;
&:last-child {
border-left: none;
border-right: none;
}
}
}
.sub-menu {
position: relative;
top: 0;
padding: 0px;
background-color: #563a92;
z-index: 1;
}
}
}
.second-navbar {
#open {
height: auto;
margin: 20px 0px;
display: block;
}
}
}