How to make a closable banner in pure javascript

2.2k views Asked by At

I want to make a closeable banner like this one at the top:

https://i.stack.imgur.com/t2m9U.jpg

using only html, css, and javascript

1

There are 1 answers

4
anmonteiro On BEST ANSWER

Check this bootstrap example: http://www.bootply.com/91822

Or this fiddle I just quickly put together: http://jsfiddle.net/foxu9o9d/ the JS goes along the lines of:

var btn = document.querySelector('#btn-dismiss');

btn.addEventListener("click", function(){
    var alert = document.querySelector('#fixed-alert');
    alert.style.display = 'none';
});