Having a few issues with the plugin jquery-cookie by carhartl... just in terms of getting a stickyfooter to appear...
The idea is that there is a stickfooter that is always at the bottom of the page, if otherwise closed. Pretty simple.
So, the onclick of the cross fires two things: to hide the stickfooter div and append a session cookie.
Right now, it pops for a split second and then hides indefinitely. But the cookie hasn't been set yet.
<script type="text/javascript">
jQuery(document).ready(function () {
if (jQuery.cookie('stickyNewsClosed') === null) {
jQuery('.stickyFooter').show();
}
if (jQuery.cookie('stickyNewsClosed') !== null) {
jQuery('.stickyFooter').hide();
}
});
</script>
<script type="text/javascript">
function closeSticky(){
jQuery('.stickyFooter').hide();
jQuery.cookie('stickyNewsClosed', 'yup', {
path: '/'
});
}
</script>
Perhaps use the .css() jquery method instead of .hide() / .show() ?
Hi please see here: http://plnkr.co/edit/yaXgcEsMuNaGu5dQJnL0?p=preview
jQuery(document).ready(function() {
console.log(jQuery.cookie('stickyNewsClosed'));
if (jQuery.cookie('stickyNewsClosed') === undefined) {
jQuery('.stickyFooter').show();
}
else if (jQuery.cookie('stickyNewsClosed') !== null) {
jQuery('.stickyFooter').hide();
}
});
function closeSticky() {
jQuery('.stickyFooter').hide();
jQuery.cookie('stickyNewsClosed', 'yup', {
path: '/'
});
}