Reputation: 1
We have a "how can we help" slide up, i've managed to add the cookie that closes the slide up from showing again if the user closes it.
Im having trouble specifying the path for the whole domain, at the moment the path is set to the current page, which is fine for that page but not the whole domain.
The body on load will check cookie, this is working but the path is not.
Any help much appreciated. Thanks in advance!
$(document).ready(function(e) {
$('#closeButton').click(function() {
var $this = $(this);
if($this.data('clicked')) {
} else {
$('.welcomepop').addClass('hide');
addCookie(10);
}
});
});
function addCookie(exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
var path = "path:'/'"
document.cookie = expires, + path;
}
function checkCookie() {
if (document.cookie == false) {
//alert("Welcome New User");
} else if (document.cookie.indexOf("expires") >= 0) {
$('.welcomepop').addClass('hide');
}
}
Upvotes: 0
Views: 20