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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:31:59+00:00 2026-06-10T21:31:59+00:00

Trying to open/close a div with the direction arrow changing on open and close

  • 0

Trying to open/close a div with the direction arrow changing on open and close but staying attached to the div as it closes and opens.

http://jsfiddle.net/siiimple/GqJj8/8/

Ideally I would like it to slide to the left as it closes (fast), then open to the right. The close “-” would change to “+” when it closed.

Thanks for any help 🙂

  • 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-10T21:32:01+00:00Added an answer on June 10, 2026 at 9:32 pm

    Departed from crowjonah’s solution, and came up with something that I think is closer to your spec.

    Check it out here:

    http://jsfiddle.net/VLNDL/

    First, restructured the divs a little so that the expand/contract buttons is a peer of the sliding div; so that it stays atatched to it during the transition:

    <div id="intro-wrap">
    <div class="open-intro">+</div>
    <div class="close-intro">-</div>
    <div id="contentWrap">
        <h1 class="main-header">Here is a Title</h1>
        <p class="main-desc">You can write whatever you want about yourself here. You can say you're a superhuman alien ant, arrived from the nether regions of Dwarf-Ant-Dom.</p>
    </div>
    

    ​
    Then refactored the CSS to: 1. make it a little simpler, 2: change around block, relative, float, and absolute so that the buttons are “pinned” to the relative div, and that’s it:

        #intro-wrap {
        position: relative;
        z-index: 1;
        border-left: 25px solid rgba(0,0,0,.2);
        width: 200px;
    }
    #contentWrap{
        background: rgba(0,0,0,.8);
        padding: 15px 40px 25px 30px;
    }
    
    #intro-wrap h1 {
        font-family: "PT Sans Narrow";
        font-size: 25px;
        color: #fff;
        font-weight: 700;
        margin-bottom: 0px !important;
        padding-bottom: 10px;
    }
    
    #intro-wrap p {
        line-height: 19px;
        color: #999;
    }
    .open-intro,
    .close-intro {
        position:absolute;
        left:200px;
        cursor: pointer;
        width: 25px;
        height: 25px;
        z-index: 50;
        padding-left:15px;
    }
    .open-intro {
        display: none;
        background: yellow 
    }
    .close-intro {
        background: red; 
    }
    

    The only thing I changed in the js is that I disabled the opacity animation, but you could bring it back — I just wouldn’t target #intro-wrap with it, you should instead target contentWrap with it:

        $('.open-intro').click(function() {
        $('#intro-wrap').animate({
        //opacity: 1,
        left: '0',
      }, 500, function() {
        // Animation complete.
      });
        $('.open-intro').hide();
        $('.close-intro').show();
    });
    
    
    $('.close-intro').click(function() {
        $('#intro-wrap').animate({
        //opacity: 0.25,
        left: '-225',
      }, 400, function() {
        // Animation complete.
      });
        $('.open-intro').show();
        $('.close-intro').hide();
    });
    

    J

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

Sidebar

Related Questions

I have code similar to: http://jsfiddle.net/jYasG/4/ HTML <a id="open" href="#">test1</a> <div id="boxbg"><a id="close" href="#">tatastat</a></div>
I am trying to create a jQuery click function that will close a div
I am trying to close parent window from child window using javascript, but its
I'm trying to write a "blinds" function that would close a DIV in a
I am trying to have a panel slide open and close on click of
I 'm trying to open fullscreen image for 2 seconds and then close the
I feel completely out of my depth but I feel so close.. I'm trying
I am trying to insert html pages to MySQL with my Asp.NET project but
I've been at this for hours but it just isn't working. I'm trying to
Am trying show a modal on mouse over and close modal on mouse out.

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.