No problem! I probably typed something wrong, i just slapped it in here to
the gmail editor :P

On 6/11/07, bsuttis <[EMAIL PROTECTED]> wrote:


Thanks a lot Matt, I understand the cookie value better now (before I
wasn't using it properly), and the fact that I can combine the css
classes reduces the code a lot, thanks.

While the above didn't work for me, I was able to rewrite my code to
get it to work, here's what I've got (it's very similar to yours) --

        $('a.show').hide();

        $('a.hide').click(function(){
                $('h2.title,.view-header-latest').add(this).hide();
                $('a.show').show();
                $.cookie('hideShow', 'hide');
                return false;
        });

        var hideShow = $.cookie('hideShow');
        if (hideShow=='hide') {
                $('a.hide,h2.title,.view-header-latest').hide();
                $('a.show').show();
        };

        $('a.show').click(function(){
                $(this).hide();
                $('a.hide,h2.title,.view-header-latest').show();
                $.cookie('hideShow', 'show');
                return false;
        });

        if (hideShow=='show') {
                $('h2.title,.view-header-latest').show();
        };


Again, thanks.


On Jun 11, 6:36 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote:
> Hi! Heres a couple things i might do
>
>        $('a.show').hide();
>        $('a.hide').click(function(){
>                $('a.show').show();
>                $('h2.title,.view-header-latest').add(this).hide(); //
> Combine multiple
>                $.cookie('hideShow","hide",{expires:365}); // Only need
one
> cookie.
>                return false;
>        });
>
>        var hideShow = $.cookie('hideShow');
>        if (hideShow=="hide") {
>                $('a.hide,h2.title,.view-header-latest').hide(); //
Combine
> multiple
>                $('a.show').show();
>        };
>
>        $('a.show').click(function(){
>                $(this).hide();
>                $('a.hide,h2.title,.view-header-latest').show();
>                $.cookie("hideShow","show");
>                return false;
>        });
>        if (hideShow=="show") {
>                $('h2.title,.view-header-latest').show();
>        };
>
> On 6/11/07, bsuttis <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi all,
>
> > After searching for a solution to my subject and not finding it, I've
> > put together my own, which while working, feels rather long to me, and
> > as more of a designer/themer, I'm wondering if this is the optimal
> > code from a developer's point of view. I'm using the excellent jQuery
> > cookie plugin for the cookies.
>
> > Here's my jQuery code:
>
> > <code>
> >         $('a.show').hide();
>
> >         $('a.hide').click(function(){
> >                 $(this).hide();
> >                 $('a.show').show();
> >                 $('h2.title').hide();
> >                 $('.view-header-latest').hide();
> >                 $.cookie('hide', '.view-header-latest',
{expires:365});
> >                 $.cookie('show', null);
> >                 return false;
> >         });
>
> >         var hide = $.cookie('hide');
> >         if (hide) {
> >                 $('a.hide').hide();
> >                 $('a.show').show();
> >                 $('h2.title').hide();
> >                 $('.view-header-latest').hide();
> >         };
>
> >         $('a.show').click(function(){
> >                 $(this).hide();
> >                 $('a.hide').show();
> >                 $('h2.title').show();
> >                 $('.view-header-latest').show();
> >                 $.cookie('show', '.view-header-latest',
{expires:365});
> >                 $.cookie('hide', null);
> >                 return false;
> >         });
>
> >         var show = $.cookie('show');
> >         if (show) {
> >                 $('h2.title').show();
> >                 $('.view-header-latest').show();
> >         };
> > </code>
>
> > What this does is uses a ul of 2 links, a show and a hide, to control
> > a div below it -- hiding the div as well as the opposite link while
> > doing so (ie. when you click the Hide li a, it hides too and presents
> > the Show li a). Any suggestions are appreciated, justr started getting
> > my hands dirty with jQuery this weekend. Thanks!


Reply via email to