• Home
  • Portfolio
  • Wordpress en Design
  • Internet
  • Ontwikkelingen internet
  • Online winkelen

Extra webmaster tips

  • Active blog
  • Beste bloggers
  • Seo marktplaats
  • Website forum
  • Gratis banners
  • Website artikelen
  • Bedrijfstelefoongids
  • Mr domein
  • Promoot je site
  • Meer tips
welkom bij i-marco
mode en webdesign Belangrijk SEO advies Volg jij al een online cursus?

Simple JQuery Accordion Plugin - Version 3.1

This is a simple menu done in JQuery. It's an evolved version of the menu first presented in the i-marco weblog entry.

I've got information man! New shit has come to light!

--Jeff Bridges as 'The Dude' in The Big Lebowski

  • Now supports nested accordions (1 level, more is madness)
  • Adds a class 'active' to any active (opened) item
  • Now supports panels that can contain anything

There is no cookie stuff. Please control state through your page (generation) code by adding the expand class to items that need to be expanded t page load time.

If this plugin is useful for you feel free to download it and use it on your website.

This plugin is discussed on my blog in this post.

1: Standard accordion menu

By default, the menu will launch in collapsed state and function like an accordion.

  • Home
  • Weblog Tools
    • PivotX
    • WordPress
    • four
    • Textpattern
    • Typo
  • A Panel

    This contains stuff

    There can be links too

    • blerk
    • wonk
    • meh
  • Programming Languages
    • PHP
    • Ruby
    • Python
    • PERL
    • Java
    • C#
  • Marco's blog (no submenu)
  • Cool Stuff
    • Bookalicious
    • Apple
    • Nikon
    • XBOX360
    • Nintendo
  • This one contains a nested accordion!
    • Weblog Tools
      • PivotX
      • WordPress
      • Textpattern
      • Typo
    • Programming Languages
      • PHP
      • Ruby
      • Python
      • PERL
      • Java
      • C#
    • Marco's blog (no submenu)
    • Cool Stuff
      • Bookalicious
      • Apple
      • Nikon
      • XBOX360
      • Nintendo
    • Search Engines
      • Yahoo!
      • Google
      • Ask.com
      • Live Search
  • Search Engines
    • Yahoo!
    • Google
    • Ask.com
    • Live Search

2: Accordion with first submenu expanded at page load

Same as the first example but with the first submenu expanded when the page loads. This is achieved by adding a CSS class expand to the item we want to be expanded.

  • Weblog Tools
    • PivotX
    • WordPress
    • Textpattern
    • Typo
  • Programming Languages
    • PHP
    • Ruby
    • Python
    • PERL
    • Java
    • C#
  • Marco's blog (no submenu)
  • Cool Stuff
    • Bookalicious
    • Apple
    • Nikon
    • XBOX360
    • Nintendo
  • Search Engines
    • Yahoo!
    • Google
    • Ask.com
    • Live Search

3: Non-accordion (standard expandable menu)

This is a standard expandable menu without accordion functionality. This is achieved by adding a CSS class named noaccordion to the unordered list.

  • Weblog Tools
    • PivotX
    • WordPress
    • Textpattern
    • Typo
  • Programming Languages
    • PHP
    • Ruby
    • Python
    • PERL
    • Java
    • C#
  • Marco's blog (no submenu)
  • Cool Stuff
    • Bookalicious
    • Apple
    • Nikon
    • XBOX360
    • Nintendo
  • Search Engines
    • Yahoo!
    • Google
    • Ask.com
    • Live Search

4: Collapsible accordion with first item expanded at page load

This menu works like an accordion when one menu item is already expanded but will collapse completely when the expanded item is clicked. Additionally it has the first item expanded at page load. This is achieved by adding a CSS class named collapsible and another CSS class named expandfirst like in example 2.

  • Weblog Tools
    • PivotX
    • WordPress
    • Textpattern
    • Typo
  • Programming Languages
    • PHP
    • Ruby
    • Python
    • PERL
    • Java
    • C#
  • Marco's blog (no submenu)
  • Cool Stuff
    • Bookalicious
    • Apple
    • Nikon
    • XBOX360
    • Nintendo
  • Search Engines
    • Yahoo!
    • Google
    • Ask.com
    • Live Search

Source

  1. jQuery.fn.initMenu = function() {
  2. return this.each(function(){
  3. var theMenu = $(this).get(0);
  4. $('.acitem', this).hide();
  5. $('li.expand > .acitem', this).show();
  6. $('li.expand > .acitem', this).prev().addClass('active');
  7. $('li a', this).click(
  8. function(e) {
  9. e.stopImmediatePropagation();
  10. var theElement = $(this).next();
  11. var parent = this.parentNode.parentNode;
  12. if($(parent).hasClass('noaccordion')) {
  13. if(theElement[0] === undefined) {
  14. window.location.href = this.href;
  15. }
  16. $(theElement).slideToggle('normal', function() {
  17. if ($(this).is(':visible')) {
  18. $(this).prev().addClass('active');
  19. }
  20. else {
  21. $(this).prev().removeClass('active');
  22. }
  23. });
  24. return false;
  25. }
  26. else {
  27. if(theElement.hasClass('acitem') && theElement.is(':visible')) {
  28. if($(parent).hasClass('collapsible')) {
  29. $('.acitem:visible', parent).first().slideUp('normal',
  30. function() {
  31. $(this).prev().removeClass('active');
  32. }
  33. );
  34. return false;
  35. }
  36. return false;
  37. }
  38. if(theElement.hasClass('acitem') && !theElement.is(':visible')) {
  39. $('.acitem:visible', parent).first().slideUp('normal', function() {
  40. $(this).prev().removeClass('active');
  41. });
  42. theElement.slideDown('normal', function() {
  43. $(this).prev().addClass('active');
  44. });
  45. return false;
  46. }
  47. }
  48. }
  49. );
  50. });
  51. };
  52.  
  53. $(document).ready(function() {$('.menu').initMenu();});

Download

Download everything in a zip file

PHP Development

For a new version of the plugin we are looking to hire a PHP developer. Sent reactions using the contact form at this page: https://www.crossinternet.nl/php-developer-php-ontwikkelaar/ - Reactions for the PHP developer position : sent us a mail.

De ontmoetingsplek voor bloggers, influencers & linkbuilders voor kwalitatieve linkbuilding vinden? Beste Bloggers met Nederlandse blogs voor linkbuilding campagnes. Kies de Beste bloggers van Nederland voor een linkbuilding campagne.

Meer over Wordpress en Design >
Copyright © 2023 Alle rechten voorbehouden I-Marco.nl | Sitemap