I have a navigation bar with the id of #navigation
, trough css the id has its margins set to -100 so it is not visible when the page loads, I then added a onLoad listener to the id. Then I wrote some js to transition the id back to be visible. The issue is that the JS does not transition the id back, it simply shows it when the page loads but there is no animation of the id transitioning back down.
HTML
<body onLoad="navBack()">
<section id="navigation">
<nav>
<ul id="navList">
<li><a href="#">Home</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</section>
</body>
Here is the JS
function navBack(){
var element = document.getElementById('navigation');
element.style.transition = "marginTop 6.0s linear 6.0s";
element.style.marginTop = "10px";
}
element.style.transition = "margin-top 6.0s linear";
margin-top
is the css property not marginTop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.