- This topic is empty.
July 25, 2014 at 3:29 am #176411tulebyParticipant
I can not get this simple accordion to work as I want. When clicking any H3 to expand the corresponding div with text, ALL of them are opened. I would of course only want them to open one at a time.
Any simplifications that could be done to CSS and or jQuery would also be appreciated.
Thanks in advance.July 25, 2014 at 4:07 am #176413
My JQuery is poor but I have this (so far)
I’m still working on having the active div hide when clicked again..July 25, 2014 at 4:53 am #176420
As I said. my JQ is pretty much cut and paste so perhaps this could all be tightened up…but it seems to work.
That was fun…I learned something.July 25, 2014 at 5:08 am #176421tulebyParticipant
Great! Thank you very much for this Paulie_D :)July 28, 2014 at 12:49 am #176640ChromawoodsParticipant
@Paulie_D it does not quite work as expected? If you expand one item and then click another one, that item does not expand. I made a fork of your fork and made a few modifications:
When we click an item, we must reference it with jQuery’s
$(this). Also cached some selectors and utilized chaining for performance.July 28, 2014 at 1:12 am #176641
Odd…it was working when I posted but OK.