I have a modal and I would like it to appear and disappear at a specific time, the idea is to notify the client that the site is closed at a certain time.
For now I have this, but it did not work.
<script>
window.onload = function () {
DisplayCurrentTime();
};
function DisplayCurrentTime() {
var d = new Date();
var hour = d.getHours();
var min = d.getMinutes();
if(hour <= 22 && min === 0){
$("#horadl").modal("show");
}else{
if(hour <= 7 && min === 0){
$("#horadl").modal("hide");
}
}
}
</script>
<div class="modal fade" id="horadl" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>-->
<h1 style="text-align: center;">Oops!</h1>
</div>
<div class="modal-body" style="text-align: justify;">
<br /><br /> En este momento nos encontramos descansando, esperamos contar con ustedes mañana.
<br /> Nuestro horario de atención es:<br />7:00 AM - 10:00 PM</div>
<div class="modal-footer"><a href="#" class="btn btn-success">Aceptar</a></div>
</div>
</div>
</div>
Please some documentation, suggestions or help. Thanks.