delarge
8/12/2016 - 8:16 AM

Setting cookies in JS

Setting cookies in JS

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script>
// remap jQuery to $
(function($){

	/* trigger when page is ready */
	$(document).ready(function (){
	// -------------------------------------

	$( "#agree" ).click(function() {
	$.cookie('phc-agree-08MFuF', 'agreed', { expires: 365, path:'/' });
	$('.desktop .notice').fadeOut('fast', function() {
	//	$('.desktop body').removeClass('mailing-list-pop-up-active');
	});
	$('.mobile .notice, .tablet .notice').remove();
//	$('.mobile body, .tablet body').removeClass('mailing-list-pop-up-active');
	return false;
	});




	// -------------------------------------
	});

	})(window.jQuery);


</script>




<?php if(!isset($_COOKIE['phc-agree-08MFuF'])) { ?>
<div class="notice">
		STUFF
</div>
<!-- notice -->
<?php } // end if cookie ?>