My mobile navigation bar currently has overflow, requiring users to scroll left or right to see all the choices. I want to implement buttons with arrows that will automatically slide the navigation bar to the desired direction when clicked.
I have attempted to use jQuery with commands like:
$('#admin-menu').animate({width:'toggle'},350);
or
$(#admin-menu).show("slide", { direction: "left" }, 1000);
or
$('#admin-menu').slideToggle( "slow" );
However, these methods do not produce the desired effect and end up causing the navigation bar to disappear.
Here is the menu bar with slider:
<nav id="admin-menu">
<span class="tab active" id="locations-tab">
<h6>Dashboard</h6>
</span>
<span class="tab" id="users-tab">
<h6>Users</h6>
</span>
<span class="tab" id="users-tab">
<h6>Users</h6>
</span>
<span class="tab" id="users-tab">
<h6>Users</h6>
</span>
<span class="tab" id="users-tab">
<h6>Users</h6>
</span>
<span class="tab" id="users-tab">
<h6>Users</h6>
</span>
</nav>
//The button to slide
<i class="fas fa-chevron-circle-right right-slider" onClick="slider()"></I>
The function created:
function slider(){
console.log('Im here!!')
$('#admin-menu').animate({width:'toggle'},50);
}
The goal is to have the navigation-bar scroll to the left upon clicking the button.