JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<article class="alert-box" id="alert-box-news">
<h1>News Alerts</h1>
<p>text text text text text text text text text text text text text text</p>
<a class="alert-box-close" id="close-alert-box-news">
<img src="http://i.imgur.com/czf8yas.png" height="25" width="25" alt="">
</a>
</article>
<article class="alert-box" id="alert-box-maintenance">
<h1>Site Maintenance</h1>
<p>text text text text text text text text text text text text text text</p>
<a class="alert-box-close" id="close-alert-box-maintenance">
<img src="http://i.imgur.com/czf8yas.png" height="25" width="25" alt="">
</a>
</article>
CSS
.alert-box {
width: 50vw;
position: relative;
margin: 20px auto;
border: 1px solid black;
}
.alert-box-close {
position: absolute;
top: -12px;
right: -12px;
cursor: pointer;
}
JavaScript
$(document).ready(function() {
var currentTime = new Date().getTime();
var timeAfter24 = currentTime + 12*60*60*1000;
$("#close-alert-box-news").click(function() {
$("#alert-box-news").hide(800);
//Set desired time till you want to hide that div
localStorage.setItem('desiredTime', timeAfter24);
});
if(localStorage.getItem('desiredTime') >= currentTime)
{
$('#alert-box-news').hide();
}else{
$('#alert-box-news').show();
}
$("#close-alert-box-maintenance").click(function() {
$("#alert-box-maintenance").hide(800);
//Set desired time till you want to hide that div
localStorage.setItem('desiredTime1', timeAfter24);
});
if(localStorage.getItem('desiredTime1') >= currentTime)
{
$('#alert-box-maintenance').hide();
}else{
$('#alert-box-maintenance').show();
}
});