Sorry Brian. Blimey, I can't believe I some of the things I come out with - looking back at what I wrote, it's (almost) a load of twaddle! Not enough coffee, me thinks .... or maybe too much! Anyway, I agree with the points you were trying to make, especially with number 1, though possibly less so with number 2 because I would probably use a class to determine which item was 'open' or 'closed'. Personal choice?
Brian Cherne wrote: > > Well, I haven't seen any other accordion panes with working links so it's > hard to tell where he'll put that data... if the data DIVs were all > siblings > (as they are currently) then this would work. There is a minor problem > with > siblings in that Mitchell's detail pane header (attrtext) is a sibling > too... so, given the existing structure, the jQuery code would have to be > something more like: > > $( targetId ).show().siblings().not('#attrtext').hide(); > > Really though, the two main points I was trying to express were: > > 1) that it looks like there could be around 50 links... it would be easier > to read, develop and maintain if there was one function (or a few > functions) > that governed all links and data instead of one click function per link. > With three links (currently) it's manageable... with 50 it would be a > needlessly verbose and bloated beast. > > 2) that there's no need to introduce additional class names or other hooks > for information that's already accessible to jQuery (like :visible) > > Brian. > > On 8/3/07, Wizzud <[EMAIL PROTECTED]> wrote: >> >> >> >> There is a possible problem using siblings() - if Basics:Location is the >> current selection, and you then browse through the other accordion panels >> then presumably while you are opening/closing panels the RH panel does >> not >> change, ie still showing Locations; if you decide to click on Belly in >> the >> Pattern panel, then you need to close Basics:Location which is not a >> sibling >> of the one you need to open! >> >> >> >> Brian Cherne wrote: >> > >> > Hi Mitchell, I'm going to try writing some code and hopefully you'll >> get >> > the >> > idea and make it work (as it's untested). Basically, instead of writing >> > everything out verbosely... try to determine automatically what needs >> to >> > happen from the information stored in the DOM. >> > >> > $('.AccordionPanelContent a').click(function(){ >> > var targetId = this.id.toLowerCase(); >> > var txt = $(this).text(); >> > >> > $("#attrname").css('background-color','#8FA9C5'); >> > $("#attrtext").text( txt ); >> > >> > $( targetId ).show().siblings().hide(); >> > }); >> > >> > I'm not sure about that last line... it depends on how many siblings. >> You >> > may consider rewriting it: >> > >> > $( targetId ).show().siblings(':visible').hide(); >> > >> > Or, possibly: >> > >> > $( targetId ).siblings(':visible').hide().end().show(); >> > >> > This page in the documentation is your friend: >> > http://docs.jquery.com/DOM/Traversing >> > >> > Also, while I've coded this with your example/HTML in mind I really >> have >> > to >> > say that I do not like having an id of "location" and an id of >> "Location" >> > ... that's just screaming for trouble. >> > >> > Cheers, >> > Brian. >> > >> > >> > >> > On 8/2/07, Mitchell Waite <[EMAIL PROTECTED]> wrote: >> >> >> >> That helps a lot Glen but I am still stuck. >> >> >> >> >> >> >> >> Here is my link >> >> >> >> >> >> >> >> http://www.whatbird.com/wwwroot/Components/Accordion%20Menu.html >> >> >> >> >> >> >> >> Each of the items inside a main menu will open its own layer, you can >> see >> >> the first two are working. >> >> >> >> >> >> >> >> And excuse my confusion I should have called this "*close all divs but >> >> one >> >> *" as it has nothing to do with "show all" >> >> >> >> >> >> >> >> I don't think :last applies to the last DIV clicked. >> >> >> >> >> >> >> >> In a DIV can I use an ID and a class at the same time? Because if that >> >> was >> >> possible I could use addclass to hide all the divs with that class, >> then >> >> show the one that is clicked (assuming I could make the close all >> happen >> >> before the show) >> >> >> >> >> >> >> >> I'm not using any tables, and all I know is if an object is visible or >> >> invisible. >> >> >> >> >> >> >> >> Thanks >> >> >> >> >> >> >> >> Mitch >> >> >> >> >> >> >> >> >> >> >> >> *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] >> >> *On >> >> Behalf Of *Glen Lipka >> >> *Sent:* Thursday, August 02, 2007 7:30 PM >> >> *To:* jquery-en@googlegroups.com >> >> *Subject:* [jQuery] Re: Show all? >> >> >> >> >> >> >> >> Might be easier if you post an page that isn't working. We could be >> more >> >> specific. >> >> However... >> >> Use a "class" when you want to refer to something that is repeated on >> the >> >> page. >> >> Also you can use :last to find the last one. >> >> $("tr:last").show() would show the last row found. >> >> >> >> Does that help? >> >> >> >> Glen >> >> >> >> On 8/2/07, *Mitchell Waite* <[EMAIL PROTECTED]> wrote: >> >> >> >> What I am looking for is a way to hide the last one of these that was >> >> clicked. I tried saving the object that was last used in a var but >> that >> >> didnt work. I thought then maybe I could create some kind of "close >> all" >> >> that would close all the other layers but not the one we have clicked >> to >> >> show. >> >> >> >> $('#Location').click(function() { >> >> $("#attrname").css('background-color','#8FA9C5'); >> >> $("#attrtext").text("Location"); >> >> $("#location").show(); >> >> $("#shape").hide(); >> >> }); >> >> >> >> $('#Shape').click(function() { >> >> $("#attrname").css('background-color','#8FA9C5') >> >> $("#attrtext").text("Shape"); >> >> $("#location").hide(); /* should hide location */ >> >> $("#shape").show(); >> >> }); >> >> >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Show-all--tf4210083s15494.html#a11977192 >> Sent from the JQuery mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Show-all--tf4210083s15494.html#a11979249 Sent from the JQuery mailing list archive at Nabble.com.