According to the question, the solution must be implemented using pure JavaScript instead of jQuery, but there is no restriction on the use of CSS. I believe that utilizing CSS is the most effective approach since the slide effect is primarily for presentation purposes.
For a demonstration, refer to http://jsfiddle.net/L9s13nhf/
<html><head>
<style type="text/css">
#d {
height: 100px;
width: 100px;
border: 1px solid red;
margin-top: -200px;
transition: margin-top 2s;
}
#d.shown {
margin-top: 100px;
}
</style>
</head>
<body>
<button id="b">Toggle slide</button>
<div id="d">Weeeeeeee</div>
<script type="text/javascript">
var b = document.getElementById('b');
var d = document.getElementById('d');
b.addEventListener('click', function() {
d.classList.toggle('shown');
});
</script>
</body></html>
The fundamental concept involves adding a class to the element you want to animate in response to a button click event (I also advocate for using a button tag over an anchor tag for semantic reasons).
The CSS automatically adjusts the margin-top property of the sliding element to make it visible on the screen. By utilizing the transition property in the CSS, the browser animates the margin-top adjustment over a two-second period.