assign each .tip div with an id. then when you set the cookie, use the
id to make it individual.
something like:

$jQ(document).ready(function() {
//Probably will want to put this in a foreach loop of IDs
        var tip = $jQ.cookie('tip_ID');

        if(tip == 'yes') {
                $jQ("#ID").hide();
        }else {
                $jQ('#ID').css('display', 'block');
                $jQ('#ID').fadeIn('slow');
                $jQ('.close').click(function() {
                        $jQ('.tip').fadeOut('slow'); //use parent to
find div id, i cant think of it now
                        $jQ.cookie('tip_ID','yes');
                });
        }
//End foreach
});

replace id with the actual id. a better way would to be to make the
cookie an array of ids

On May 19, 1:39 pm, ocptime <[email protected]> wrote:
> Hi,
>   In my application I have many tips ( which are divs ) for eg: a tip
> explaining what are recurring invoices, items etc. Each of these tips
> has a close button, when closed will set a cookie with value "true".
> tip1 cookie value =1 which then will dismiss this tip. So the next
> time a page is loaded, the tip will not be show.
>
> Now the issue is i have many tips, so what i am using now is:
>
> $jQ(document).ready(function() {
>         var tip = $jQ.cookie('tip');
>
>         if(tip == 'yes') {
>                 $jQ(".tip").hide();
>         }else {
>                 $jQ('.tip').css('display', 'block');
>                 $jQ('.tip').fadeIn('slow');
>                 $jQ('.close').click(function() {
>                         $jQ('.tip').fadeOut('slow');
>                         $jQ.cookie('tip','yes');
>                 });
>         }
>
> });
>
> so it will close all tips if the value is true. How can i make it set
> for each tip, ie; make it generic?
>
> Any help appreciated.
>
> Thanks in advance,
> ocptime

Reply via email to