Simple Cookies Script

Open and close the cookies on the footer.

by sulfureous

HTML

<div id="cookiesBarCont">
    This site uses Cookies <a href="#" class="btn">I Understand</a>
</div>
<div id="cookiesBtnToggle">
    <a href="#" class="btn">Open Cookies</a>
</div>

CSS

#cookiesBarCont {
    background: rgba(0,0,0,0.7);
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
    text-align: center;
    color: #fff;
}
#cookiesBtnToggle {
    position: fixed;
    bottom: 0;
    right: 20px;
    text-align: center;
    color: #fff;
}
.btn {
    background: #777;
    border: 1px solid #aaa;
    padding: 3px 10px;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
}

JavaScript

$('#cookiesBtnToggle').hide();

$('#cookiesBarCont a.btn').bind('click', function(){
  $('#cookiesBarCont').slideUp();
  $('#cookiesBtnToggle').show();
});

$('#cookiesBtnToggle a.btn').bind('click', function(){
  $('#cookiesBarCont').slideDown();
  $('#cookiesBtnToggle').hide();
});