Glen and Matt, thanks for your responses!

I've spent a bunch of time on this tonight and managed
to get a working solution, though I'm hoping to tweak
it a little now. 

(url for a refresher... note, i've been working off a
different page now, so these new changes aren't up. At
least this will show you the div structure:
http://anime-planet.com/newsite/anirec/5.html )

Expected behavior:

-click any button while no dropdowns are visible:
dropdown associated with button lowers.

-click the SAME button once the dropdown is visible:
dropdown hides.

-click a DIFFERENT button once the first dropdown is
visible: first dropdown raises, and new dropdown
associated with new button lowers.

I decided the best way to do this, since I don't want
to preload all of the info that will be in these
dropdowns, was to use the same div (.anirec_more) and
simply use ajax or something else to populate it
depending on what you click (haven't done this part
yet).

I got #1 and 3 done, but can't get #2 to work. Here's
what I have (I know it's incorrect):

$('div.anirec_buttons img').click(function() {
                                
        if
($(this).parents('div.anirec_main').next().is(":visible"))
        {
        
$(this).parents('div.anirec_main').next().slideUp(400);


                if
($(this).parents('div.anirec_main').parent().is(":"+$(this).attr("id")))
                {     
                        //Not sure how to do a "is not" function in jquery,
or i'd structure it that way                    
                }
                else
                {
                                        
$(this).parents('div.anirec_main').next().slideDown(400);
                                        
$(this).parents('div.anirec_main').parent().addClass($(this).attr("id"));
                }

        }
        else
        {

        
$(this).parents('div.anirec_main').next().slideToggle(400);
        
$(this).parents('div.anirec_main').parent().addClass($(this).attr("id"));
        }
        return false;
});

My reasoning: since the outermost div of each series
entry has no class, I could append a class to it
matching the id of the clicked button. Then, I could
compare the currently clicked button's ID with
whatever the dropdown div's outermost parent has a
class set as. If they match, don't slidedown the new
div or give a new class name to the div. If they don't
we know a new button has been clicked and must act
accordingly.

Any ideas on how I could make that happen? I tried out
the code above and it's not working right. 

My only other question is related to settimeout; I
want a second or two delay before the second dropdown
comes down, but am not sure how to pass the this
object into another function, to pass to settimeout.I
could probably post this in a different thread. :)

thanks,
-kim 

--- Glen Lipka <[EMAIL PROTECTED]> wrote:

> Mirroring back the desired effect:
> 1. Start with all DIVS hidden.
> 2. Click a button, and that *related* DIV opens and
> all other open DIVs
> close.
> 
> You might want to use the "each" function for this. 
> Untested code:
> $("div.anirec_buttons img").each(function(i){
>   $(".anirec_more").slideUp("slow"); //move them all
> back up
>   $(this).siblings("div.anirec_more").slideDown();
> //goes relative to the
> one that was clicked and gets the brother div.
> 
> });
> 
> I see someone has posted to this message, so Ill
> stop.  Im so slow. :)
> GMail is funny that way.  It pops up a little
> message saying, "Someone
> already answered the question slow poke."  Hope this
> helps anyway.
> 
> Glen
> > _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to