jQuery ccookie
jQuery ccookie
I have a multiple alert system that display uniform alerts on all pages. I want when any of the alerts is closed, let it stay closed on all other pages on the website. I have tried so many thins but nothing works. It only. works when it is just one alert.
- // Alert session cookie starts here
- jg(document).ready(function () {
- function closeBox() {
- var closeBox = jg('.alert-box:visible').hide();
- // - Notice how we pass a function and get an integer
- jg.cookie('Alert-closed', true, {
- path: '/'
- });
- }
- console.log('Alert-closed');
- // - Simply checks the alert box above
- if (jg.cookie('Alert-closed')) {
- console.log('Closing the alert box automatically...');
- closeBox();
- }
- // Close the box on click
- jg('.alert-switch').click(function () {
- closeBox();
- });
- });