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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:48:02+00:00 2026-05-17T17:48:02+00:00

I am using slide out panel that on default is set to display:none. If

  • 0

I am using slide out panel that on default is set to display:none. If the trigger is clicked it will toggle the class to “active”. That makes the trigger show a red x (for close) that comes from a sprite position.

$(document).ready(function(){
$(".info-panel-left-trigger").click(function(){
 $("#info-panel-left").toggle(400);//switching between display and display:none
 $(this).toggleClass("active");
 return false;
});

});
So this is what I have but now comes what I want and maybe one of you got a clou how to achieve this.
I would like to create the option to have the panel either shown on default or hidden on default and the toggle should behave accordingly. This would mean that if I have chosen to show the panel on default that the toggle should be set to “active” in order to show the x sprite position. If I have chosen to hide the panel on default the toggle should be set to “not active” in order to show the + sprite position.

I hope I have made myself clear enough. HELP is appreciated very much.

EDIT You guys are right. Some more explanation is needed. I just wanted it to make as short as possible but here is some more…

I am creating a website template and the buyer of the template should be able to include those panels for information purposes. On default it should set up showing the panel and have set the trigger class to “active”. This would show my little x for close.
But if the buyer of the template add the extra class “hide” to the panel markup the panel should be hidden on default and the trigger should not be set to active because in that case my trigger would show the little + for open this panel. Got my idea now?

  • 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-17T17:48:02+00:00Added an answer on May 17, 2026 at 5:48 pm

    Where (and how persistent) do you store this default? Just on the client for that session, or server-side? Server-side would seem most logical to me.. if so, when the user has chosen to show the panel, add a class to the info-panel-left’s html. Assuming we then have

    <div id="info-panel-left" class="shown"></div>
    

    Add a bit of javascript so it reads

    $(document).ready(function(){
        var infoPanel = $( '#info-panel-left' );
        var infoPanelTrigger = $( '.info-panel-left-trigger' );
    
        if ( infoPanel.hasClass( 'shown' ) ) {
            infoPanel.show();
            infoPanelTrigger.addClass( 'active' );
        }
        ... etc ...
    

    (you could just use the ‘active’ class as well of course)

    EDIT: okay; if we just stick to the JS part, I don’t think that changes the approach much, does it? Just reverse it:

    <div id="info-panel-left" class="hide"></div>
    

    then

    $(document).ready(function(){
        var infoPanel = $( '#info-panel-left' );
        var infoPanelTrigger = $( '.info-panel-left-trigger' );
    
        if ( infoPanel.hasClass( 'hide' ) ) {
            infoPanel.hide();
            infoPanelTrigger.removeClass( 'active' );
        }
        ... click trigger, toggle etc ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive got a div that i want to slide out on click using .show(slide,
I'm using a simply Javascript that makes a menu slide out upon mouseenter then
I am using a jquery slide in slide out that appears on the page
I have a series of divs that slide down using -webkit-transform from a negative
I am using Powerpoint 2007 and I have set up hyperlink from slide A
I am using Jquery UI tabs, and have it set to toggle the opacity
I have a page that is laid out using DIV s, and it essentially
I am using JQuery to animate a panel system menu. The problem is that
I am trying to figure out the efficiency of my server side code. Using
I am using jakarta/slide project for implementing webDAV client on my android device. I

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.