Jump to content

- - - - -

[Request] expandable/shrinkable categories

  • Please log in to reply
No replies to this topic

#1 Usher


    New Member

  • Members
  • Pip
  • 24 posts

  • United States

Posted 27 April 2008 - 05:52 PM

Ok, so I've been racking my brain for well over a week now on how to do this, and in the process have learned more javascript than I'd like to have.....but I've come up with a UGLY and only partially working piece of concept code to make sorting through categories a bit easier (I've got dozens, and it's annoying at least for me to sort though).
I'd love to have something to the effect of DeviantArt's category picker, but that's probably some outrageous code.
I had two areas I was focusing on.
1. The 'Browse' page (display.php) - Allowing the main categories to show by default, and expand as you click on their row.
This I have working to a degree, it seems glitchy, and doesn't close up properly because I forgot to pass in a 'closing or opening' condition.
2. The categories dropdown on many pages (f_cats.php) - Something more manageable than a 100 category dropdown.....
This I attempted to get working as a <select multiple> but the closest thing I got to working had tons of gaping holes.....not the goal

This required some in-depth breaking of code, and I'm not happy with the result, but I'm still an amateur at php and javascript, so maybe you can grow this concept beyond what I've done.

Just FYI, the javascript I've made works pretty darn well for almost anything to be accordion'ed.
All things below the clickable must be at sibling or child level to it
Each header must contain 'class="open beginsub" onclick="test(this, 0)" style="display:"' in order to operate
Each item in the subgroup must contain either 'class="open"' or 'class="close"'
The final item in the subgroup must contain "class="open/close endsub"

Don't have to be the same type of object, don't have to have id's....just those classes, and the clickable on headers.....kinda cool and really simple.
Needs to have a 'close all subgroups below me' flag sent in, that gets set on the first click when you decide whether to open or close, otherwise closed subgroups get opened and opened subgroups get closed, regardless of the status of the header.

So let me know what you think, and how we could improve. (and DO NOT FORGET to back things up before making these changes, they're poorly tested)


Attached Files

Everyone told me I was daft to build a castle on a swamp! So I did.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users