I’m trying to get the modal only to pop up once per week.
I’m using WordPress, and Roots theme, and have the scripts enqueued and registered correctly.
My code for the modal is
<div class="modal hide fade modalborder" id="myModal">
<div class="modal-header">
<a class="close" data-dismiss="modal">Ã</a>
<div class="modal-body">
<h2 class="modalheader">Header Here</h2>
<p class="modalcoffee">Text here</p>
<p class="modalcomesin">Text here</p>
</div>
<p class="modallearn">Text Here</p>
<p class="modalready">Are you ready to <span class="modalstart">start</span>?</p>
<a href="#" class="btn btn-info">Click Here</a>
</div>
</div>
The current javascript to make this show works perfectly:
<script type="text/javascript">
$(window).load(function(){
$('#myModal').modal('show');
});
</script>
I know very little about jQuery and javascript for that matter. What would I need to do to make this work with cookies?
First you need to include the JQuery cookie plugin like so:
Then the following code should help you:
same as @mccanff answer but without using external libs