This is what I ended up with - not sure how to turn it into a session cookie though. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="bpsModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false"> > <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title mx-auto" id="bpsModalLabel">SAFEGUARDING & GDPR NOTICE</h5> </div> <div class="modal-body text-center"> We are committed to safeguarding and promoting the welfare of children and young people. To view our website we ask you to accept our policies. For more information please click on the button below.<br><br> <div class="text-center"> <a href="safeguarding_gdpr_acceptance.html" target="_blank"><button type="button" class="btn btn-primary">View our policies</button></a> </div> </div> <div class="modal-footer mx-auto"> <!-- Make sure to include the 'nothanks' class on the buttons --> <a href="http://www.google.co.uk"><button type="button" class="btn btn-primary">I don't accept</button></a> <button class="btn btn-primary nothanks" data-dismiss="modal" aria-hidden="true">I Accept</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <script> // Delayed Modal Display + Cookie On Click $(document).ready(function() { // If no cookie with our chosen name (e.g. no_thanks)... if ($.cookie("no_thanks") == null) { // Show the modal, with delay func. $('#myModal').appendTo("body"); function show_modal(){ $('#myModal').modal(); } // Set delay func. time in milliseconds window.setTimeout(show_modal, 1000); } // On click of specified class (e.g. 'nothanks'), trigger cookie, which expires in 100 years $(".nothanks").click(function() { $.cookie('no_thanks', 'true', { expires: 36500, path: '/' }); }); }); </script>
... View more