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

  • Home
  • SEARCH
  • 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 7833875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:56:49+00:00 2026-06-02T12:56:49+00:00

My main problem is that I want to create an accordion based website in

  • 0

My main problem is that I want to create an accordion based website in jquery,when the accordion button is clicked it opens the content for it.

But I cant figure out how can i implement,that when is create a top menu for it it also controls the sliding of it.

So for example: on the main content,I click on the work accordion button– it slides down and shows the attached content for work… but i dont know how to link the top menu’s “work” button to slide down that same content.

html:

<div id="wrapper">
    <div class="accordionButton"><img src="work.png" width="666" height="84"></div>
    <div class="accordionContent"><img src="7.jpg" width="900"></div>

jquery:

$(document).ready(function() {

//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.accordionButton').click(function() {

    //REMOVE THE ON CLASS FROM ALL BUTTONS
    $('.accordionButton').removeClass('on');

    //NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
    $('.accordionContent').slideUp('normal');

    //IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
    if($(this).next().is(':hidden') == true) {

        //ADD THE ON CLASS TO THE BUTTON
        $(this).addClass('on');

        //OPEN THE SLIDE
        $(this).next().slideDown('normal');
     } 

 });


/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
$('.accordionButton').mouseover(function() {
    $(this).addClass('over');

//ON MOUSEOUT REMOVE THE OVER CLASS
}).mouseout(function() {
    $(this).removeClass('over');                                        
});


$('.accordionContent').hide();

css:

#wrapper {
width: 1100px;
margin-left: auto;
margin-right: auto;
}
.accordionButton {  
    width: 900px;
    float: left;
    _float: none;



border-bottom: 1px solid #FFFFFF;
cursor: pointer;
}

.accordionContent { 
    width: 1000px;
    float: left;
    padding:20px;
    _float: none; 
    background: #fff;
    }
  • 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-06-02T12:56:50+00:00Added an answer on June 2, 2026 at 12:56 pm

    You can also use the Jquery trigger functionality.Which simulates a given event on selectors you pass to it.

    Lets say you have five accordion divs,resultingly you will have 5 menu elements.

    Just wire you menu elements to do something like follows:

    $("#menuitem1").click(function(e){
        $("#accordionLi1").trigger("click");
    });
    

    Ideal you should just loop thru all the available elements and attach triggers to them.
    something like:

    for(var i=0;i<n;i++)
    {
        $("#menuitem"+i).click(function(e){
            $("#accordionLi"+i).trigger("click");
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for a localized website I want to create different language files. But my main
My main problem is that I want to use myfaces jsf implementation and because
I want to create a plugin with omnibox suggestion. The main problem - if
hi i want to create user search fully driven with sphinx. problem is that
The main problem I'm having is pulling data from tables, but any other general
So, i want to create an app that can give it's user a notif
I want to create a collection of classes that behave like math vectors, so
So I got a problem with saving my pdf. I want to create an
I want to create a tree that it's child nodes contain specific flex components
Main problem: how do i group elements by their Date, only if continuous and

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.