I'm using the jQuery Cookie plugin (https://github.com/carhartl/jquery-cookie) and I'm having issues persisting my cookies across different pages on my website.
I have a piece of content that displays on each page and once hidden it sets the cookie like so (Apologies for all of the variables, they are not at all relevent :
// Binds the close event to the button.
$alert.on('click', function(e) {
$alertWrap.fadeOut();
// Sets the breaking-delete cookie to yes.
$.cookie('breaking-bar-delete', 'yes', {expires: 7 });
});
When the initial script fires it checks to see if the cookie exists:
// If the current bar is not supressed and they are not in the editor, and they do not have a closed cookie it will setup the bar.
if ($.cookie('breaking-bar-delete') == undefined) {
$alert.css("display","block");
}
// If there's no news, or they have the closed cookie for the current bar it hides it by default.
if ($.cookie('breaking-bar-delete') == 'yes') {
$alert.parent().css("display","none");
}
Now this works for the path that you hide the bar on so it doesn't re-display if you refresh. But if you go to a part of the site with a different path it doesn't detect the cookie and displays the content.
Is there some sort of configuration I can set when I initially serve the cookie so it persists throughout all of the pages on my site?