While clicking myLinks
heading should come from left side and push the page with having a transition of 3 seconds. I have tried so many methods still I'm getting wrong.
If anyone could help me it will be welcome.
function myFunction() {
var x = document.getElementById("myLinks");
if (x.style.display === "block") {
x.style.display = "none";
} else {
x.style.display = "block";
}
}
body {
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow: hidden;
background-color: #333;
position: relative;
align-items: center;
}
.topnav #myLinks {
display: none;
}
.topnav a {
color: black;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
display: block;
align-content: center;
background: #ddd;
}
.topnav a.icon {
background: white;
display: block;
position: absolute;
left: 0;
top: 0;
}
.topnav a:hover {
background-color: white;
color: black;
}
.active {
background-color: white;
color: black;
font-size: 20px;
font-weight: bold;
text-align: center;
}
.topnav-buttons {
display: flex;
gap: 10px;
position: absolute;
right: 0;
top: 0;
height: 48px;
}
* {
margin: 0;
}
<div class="topnav">
<a class="active">INVOICE</a>
<div class="topnav-buttons">
<button onclick="location.href='invoiceAdd.html'">Add Invoice</button>
</div>
<div id="myLinks">
<a href="transactions.html">Transaction</a>
<a href="product.html">Product</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i class="fa fa-bars"></i>
</a>
</div>