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 7540055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:32:39+00:00 2026-05-30T07:32:39+00:00

This is the code i am using to hide and display div’s with a

  • 0

This is the code i am using to hide and display div’s with a slide toggle effect.

jQuery(document).ready(function() {
    jQuery(".option-content").hide();
    jQuery(".option-heading").click(function()
        {
            jQuery(this).next(".option-content").slideToggle(500);
        });
    });

However i would like to add some toggled arrows to show that the toggled div is up or down.

This is what i have so far and it does half of what i would like it to do:

jQuery(document).ready(function() {
    jQuery(".option-content").hide();
    jQuery("#arrow-up").hide();
    jQuery(".option-heading").click(function()
        {
            jQuery(this).next(".option-content").slideToggle(500);
            jQuery("#arrow-up").toggle();
            jQuery("#arrow-down").toggle();
        });
});

This toggles the arrow but there are two problems:

  1. The down arrow stays shown
  2. Every div toggles every arrow so when some divs are up and one is down they all show as down.

Any ideas would be appriciated

  • 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-30T07:32:41+00:00Added an answer on May 30, 2026 at 7:32 am
    • Use :before pseudo for decorative arrow icons
    • Use jQuery’s .toggleClass()
    jQuery(function($) { // DOM ready and $ alias in scope
    
      /**
       * Option dropdowns. Slide toggle
       */
      $(".option-heading").on('click', function() {
        $(this).toggleClass('is-active').next(".option-content").stop().slideToggle(500);
      });
    
    });
    .option-heading:before           { content: "\25bc"; }
    .option-heading.is-active:before { content: "\25b2"; }
    
    /* Helpers */
    .is-hidden { display: none; }
    <div class="option-heading">HEADING</div>
    <div class="option-content is-hidden">
      content<br>content<br>content<br>content<br>content<br>content<br>content
    </div>
    
    <script src="//code.jquery.com/jquery-3.3.1.js"></script>

    P.S: If you’re using some different font-icons (like i.e: icomoon) than add the respective hex codes and also font-family: 'icomoon'; to the :before pseudo.

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

Sidebar

Related Questions

I'm using this code: <script type='text/javascript'> $(document).ready(function () { //Check if url hash value
I'm using this jquery code to show and hide divs on my page. As
I am currently using this code: $('#startLabel').live('mouseover',function(){ $('.startTooltip').fadeIn(); }); $('#startLabel').live('mouseout',function(){ $('.startTooltip').fadeOut(); }); to display
Using jQuery 1.5.1 Tried this block of code in: head section as well as
I am using the following code: <div id=trialwindow style=display:none; background-color: #ffffff; position:fixed; z-index:1000; top:40px;
I have this code: function displayLoader( toggle ){ if( toggle === 'show' ){ $('.overlay,
Hi again :) I'm using jQuery script to show/hide some content: <script type=text/javascript> $('.toggleButton').click(function()
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
I have this code :- using (System.Security.Cryptography.SHA256 sha2 = new System.Security.Cryptography.SHA256Managed()) { .. }
I have this code: using DC = MV6DataContext; using MV6; // Business Logic Layer

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.