Not Solved jQuery Hide
#11
Not Solved
Yes, the cookie plugin does offers a way to get all cookies, however I'm not entirely sure how to use it Toungue
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#12
Not Solved
You want the code in jQuery or in PHP?

I assume you want the jQuery version since you are a PHP expert :p

This is how it works with jQ:

/*
// Set some dummy cookies with boolean values
$.cookie('oguc_annbars_1', 1);
$.cookie('oguc_annbars_2', 0);
$.cookie('oguc_annbars_3', 0);
$.cookie('oguc_annbars_4', 1);
*/

// Check if the cookie is for oguc and hide div according to value
$.each(document.cookie.split(/; */), function()  {
var oguc_state = this.split('=');
    if((oguc_state[0].substr(0, 12)) == 'oguc_annbars' && oguc_state[1] == 0){
        $('#'+oguc_state[0]).hide();
        //alert('#'+oguc_state[0]); << Debug line
    }
});


Also, why you are using Cookie.set() & Cookie.get() when it can be:
To set:
$.cookie('oguc_annbars_1', 1);

and to unset:
$.removeCookie('oguc_annbars_1');

Pure jQ style Big Grin
Reply
#13
Not Solved
The cookie plug-in doesn't uses the MyBB cookie by itself.

Will try your codes, thanks!
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)