Can anyone advise on an accordion for the left nav on the category pages? Is there a possibility to do this purely using CSS? Or do I need jquery?

  • you can't get the onclick event by css, you need javascript to do this. – MeenakshiSundaram R Sep 26 '15 at 18:02
  • you are using cusom rwd theme or else – Magento 2 Sep 26 '15 at 18:04
  • Correct I'm using a custom RWD theme... – YorkieMagento Sep 26 '15 at 20:28
  • 1
    @MeenakshiSundaram, this is not true at all and there are very many ways of building a fully functional accordion menu without jQuery (or any script) at all. – David Lerner Sep 28 '15 at 1:33

You can accomplish this with any combination of Pure CSS alone, CSS + jQuery/Javascript, jQuery/Javascript (although this would be relatively pointless, considering you'd still need the CSS to style the way the menu looks).

Here are a few examples of Pure CSS accordion menus:

And a few examples of jQuery + CSS accordion:

While you can do more with jQuery, it's preferable not to use it if you have the luxury. In this case, assuming the mention CSS accordion menus fulfil your requirements, why should you burden your visitors and their browsers with the unnecessary script?

Note: The only instance where jQuery might be preferable is if you intend on supporting pre-IE9 browsers and some modern CSS features are not fully supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.