I have this code (running on www.dtwdev.co.uk/errors/index.html)
which is basically the following:
<script>
function slideUpClose(el) {
var panel = document.getElementsByClassName(el);
panel.style.transition = "top 0.5s ease-out 0s";
panel.style.top = "-1000px";
}
</script>
with a little styling
<style>
#selection {background:#f1f1f1; width:600px; height:300px;}
</style>
and the HTML:
<div id="selection" class="slideUp">Content heading
<div>
<button class="close_button" id="close_this_content_panel" onclick="slideUpClose('slideUp')">Click to close</button>
<p>Some content goes here</p>
</div>
</div>
What I'm looking for is for when the button is clicked, the content panel should slide up and out of the window. I've managed to get this working with document.getElementById but am having trouble making it work for class names. Would appreciate any advice!