jwoker Posted May 31, 2006 Share Posted May 31, 2006 I would like to create a list which, when an item is clicked, expands to show additional text regarding the item. Then if another list item is clicked, the previous text would collapse and the current items descriptive text would be shown.Is this possible with CSS? or can someone point me in the right direction. Link to comment Share on other sites More sharing options...
real_illusions Posted May 31, 2006 Share Posted May 31, 2006 something like this?http://www.dynamicdrive.com/dynamicindex1/switchmenu2.htm Link to comment Share on other sites More sharing options...
BalconyShore Posted May 31, 2006 Share Posted May 31, 2006 Is there a way for the list to close when you click on another topic? As in you had already clicked on "list" and topics appear, but when you click on "OtherList," "List's" topics closes and "OtherList's" topics are featured.List OtherList ==Click==> List OtherList1 1OL2 2OL3 3OL Link to comment Share on other sites More sharing options...
Jack McKalling Posted May 31, 2006 Share Posted May 31, 2006 This cannot be done by CSS only, there has to be some sort of JavaScript in it :)There is a possible way indeed, not very complicated I guess.Say your list contains ten items. At initial load, none item is expanded. Each item consists of both an html element for itself, and another element for the additional information. The second element, I will call a infobox. There are two classes defined, "collapsed" and "expanded". They count for the infoboxes, and all of them are classed "collapsed" at initial load. If JavaScript detects a click on the item itself, the according infobox will get its class changed into "expanded". It even counts what infobox is expanded, so if there occures another click, the previous infobox will collapse again.So basically:-two classes for the infoboxes "collapsed" and "expanded";-statistic the last expanded infobox-on click event, collapse the previuos infobox (if present) and expand the clicked item's infoboxThats all there is to it :)Would this help you, or do you need more help with the code? (at least this should move to the JavaScript section, as you wouldn't have known by your self) Link to comment Share on other sites More sharing options...
scott100 Posted May 31, 2006 Share Posted May 31, 2006 Is there a way for the list to close when you click on another topic? As in you had already clicked on "list" and topics appear, but when you click on "OtherList," "List's" topics closes and "OtherList's" topics are featured.List   OtherList  ==Click==> List    OtherList1                              1OL2                              2OL3                              3OL<{POST_SNAPBACK}> Is that not the same as what was originally asked But like Dan said you would require javascript to do this with onclick, then it's a matter of changing the display. Link to comment Share on other sites More sharing options...
jwoker Posted May 31, 2006 Author Share Posted May 31, 2006 Thanks all - I will go look for javascript solution. Link to comment Share on other sites More sharing options...
scott100 Posted May 31, 2006 Share Posted May 31, 2006 Thanks all - I will go look for javascript solution.<{POST_SNAPBACK}> Well i've been playing around with this and come up with this:http://scott100.atspace.com/list.htm Link to comment Share on other sites More sharing options...
jwoker Posted May 31, 2006 Author Share Posted May 31, 2006 Thank you for the striaght forward and simple solution Scott Link to comment Share on other sites More sharing options...
scott100 Posted May 31, 2006 Share Posted May 31, 2006 Thank you for the striaght forward and simple solution Scott<{POST_SNAPBACK}> No worries, if you need more help with it then let me know Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now