JavaScript / jQuery

Super Simple jQuery Accordion Snippet

Google+ Pinterest LinkedIn Tumblr

This very simple jQuery Accordion Snippet will help you save space and divide your content into different logical sections. No fancy setting parameters, no need for a function call, simply add the JS file to your head and enjoy a minimal, cross-browser working Accordion.

Preview

Simple Lingulo-Accordion

What you need to do

  1. Include the minified or the original JS file
  2. Add the CSS rules to your CSS file
  3. Add your HTML code
    • create an element with the ID lingulo-accordion (or change it in the JS file if you would like to use a different ID)
    • for each toggable section create a div
    • add an element h3 as well as your content into the div

Please note: I do not guarantee the correctness of this script and can not be made responsible for any damage or loss caused through the use of this script

I am a frontend and backend web developer who loves building up new projects from scratch. In my blog "Lingulo" me and some guest authors regularly post new tutorials, web design trends or useful resources.

4 Comments

  1. Chris, great simple solution! I’m using this to show details on a product page that has multiple instances of the “” tag. I need to have each individual product detail work independently when clicked. Currently, when I click the accordion, it only opens the first instance of the DIV. I know I need to add a dynamic ID which I can easily do using PHP in the tag above, but not sure what I need to add in the JS file.

    • Chris Reply

      Hi Shamgarr,

      I think some part of your comment has been removed unfortunately. Which tags do you use multiple times? Could you provide a link to your page, then I could have a look at it.

      Best regards

      Chris

  2. Super Script. Unfortunately I didn’t see the download link. Do I have to find the jQuery file on the internet?
    Hi Christoph, I have another question (problem) concerning the lingulo-website which I downloaded and changed to meet my needs. Now the question: In the header there is this fantastic image slider. I would like to use this script in another part of the home page with different size pictures. How can I adapt the size / format of the images shown on the page – e.g. 300x200px? Image sliders are so powerful that I would like to be able to really control them.
    Thanx a million

    Josef

    • Hey Josef,

      thank you for your comment, to change the height of the images you would need to adapt the “height” value in the function call $(‘#slides’).slidesjs({ height: your_height

      Best regards

      Chris

Write A Comment