I am facing an issue with pushing my menu along with the content to the right. The JS code I have is not working as expected. When I click on
<div class="menu-btn toggle"></div>
, the menu does not trigger. Can someone help me understand why this might be happening and how to fix it?
JS
$(function() {
$('.toggle').on('click', function() {
$('.wrapper').toggleClass('open');
});
});
CSS
.wrapper {
transform: translateX(0px);
transition: transform .4s ease;
}
.wrapper.open {
transform: translateX(280px);
}
#main-nav {
transform: translateX(-280px);
}
HTML
<div class="wrapper">
<nav id="main-nav">
<div class="menu-btn toggle"></div>
<ul></ul>
</nav>
</div>