I am not very experienced in JavaScript or jQuery, but I have created an age verification popup. I need to add cookies to my "yes button" function so the popup doesn't show if a user visits within 7 days. Here is the codepen
I have researched enough to know I should be using js-cookie. Just no idea how to implement. This is as far as I have got.
<!--HTML-->
<div class="popup">
<div class="popupWindow">
<div class="popup_txt">
<div class="row">
<center><img src="images/logo.png" class="img-responsive" width="400px"></center>
</div>
<hr style="border-top: 1px solid #000;">
<div class="row">
<h2>Where You Born Before</h2>
<h1 class="text-center"><span id="date"></span>?</h1>
<div class="popup_img answer">
<button class="popup_img_yes btn btn-primary btn-lg">Yes</button>
<button class="popup_img_no btn btn-primary btn-lg">No</button>
</div>
</div>
</div>
jQuery(document).ready(function( $ ) {
jQuery(".popup_img_yes").click(function(){
jQuery(".popup").fadeOut( 1200 ); });
});
I am guessing I need to use the following somehow:
Cookies.set('name', 'value', { expires: 7 });