Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:03:43+00:00 2026-05-14T04:03:43+00:00

I have a show/hide toggle working well in multiple instances (thanks to help here

  • 0

I have a show/hide toggle working well in multiple instances (thanks to help here – search for ‘jquery toggle to work in multiple instances’).

I want to integrate it into an expanding menu / accordion style for the main categories.
I have a script and it works on its own but I can’t get it to work integrated with the show/hide.

The working show/hide:
http://pastebin.me/c69869d7a80fdb439ca16304b821c146

the expanding menu script I want to integrate:
http://pastebin.me/03b685f586fef84193b5fd72e815255d

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:03:43+00:00Added an answer on May 14, 2026 at 4:03 am

    I’m not sure exactly what you’re after, so this is a bit of a guess and a quick rought cut, needs optimization, but should work:

    jQuery.fn.expandingMenu = function(options) {
       settings = jQuery.extend({
         speed: 500,
         show: 10,
         hideCaption: 'Hide',
         showCaption: 'More'
      }, options);
    
      if (this.children('.active').length) return this;
    
      this.each(function() {
        if ($(this).children().slice(settings.show).hide().length) {
           $(this).append($('<li class="toggler">' + settings.showCaption + '</li>').toggle(function() {
              $(this).text(settings.hideCaption).siblings().slideDown(settings.speed);
           }, function() { 
              $(this).text(settings.showCaption).siblings().slice(settings.show + 1).slideUp(settings.speed);
           }));
        }
    
        $(this).children().hide().first().show().css({cursor:"pointer"}).toggle(function () { 
          $(this).siblings().slice(0, settings.show).add($(this).siblings('.toggler')).show(settings.speed);
        }, function () {
            $(this).siblings().hide(settings.speed);
        });
      });
      return this;
    };
    
    $(function() {
        $('ul').expandingMenu({ speed: 200, showCaption: "Gimme More" });     
    });
    

    See it in action here. This example makes it a plugin model, so you can call $('ul').expandingMenu() (and chain it) like the example above with options for speed, how many to show, and the hide/show captions as well. Take a peek and tell me which parts aren’t quite right, easy to adjust from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok, So I have multiple divs(7) which I want to toggle for show hide.
Okay, here's my problem. I have a page where I use toggle to show/hide
I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have a toggle button, with a show/hide feature in javascript. How do I
I have a div show hide function which is working fine. when I click
I have a script working to show hide the next() tbody element when another
I have a toggle event that is being used to show and hide a
I have a div and I want to show and hide on a link
I have about 25 show/hide (toggle) elements on a page like so... HTML: <h2><a
I have a menu with submenus that can be toggled (hide/show type deal). Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.