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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:13:20+00:00 2026-06-09T15:13:20+00:00

I have a jfiddle below that has two links that expand two divs independently

  • 0

I have a jfiddle below that has two links that expand two divs independently and horizontally.
http://jsfiddle.net/j9W7R/

How would I go about causing only one div to be seen any any given time? Say you click the first one, then click the second and it causes the first to contract. Or if you click the first and click the first again it would also retract.

The idea is that the link will be a Facebook icon, the next link will be another social media icon, etc. etc. and I will embed a little “like us” or some sort of interaction with user.

  • 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-09T15:13:21+00:00Added an answer on June 9, 2026 at 3:13 pm

    You can do it next way:

    To all your sliding <div>s add some class. class="slickbox" for example.

    And each .click() start with $('.slickbox').hide(); hiding all boxes first and than expanding the one you need.

    For e.g.:

    <div style="clear:both;">
    
      <div style="float:left;">
        <a href="#" id="slick-slidetoggle2">Slide toggle the box 2</a>
      </div>
    
      <div id="slickbox2" class="slickbox">
        2: This is the box that will be shown and hidden and toggled at your whim. :)
      </div>
    
    </div>
    

    And one of clicks will look like this.

    $('#slick-slidetoggle2').click(function() {
        $('.slickbox').hide(); // hide all boxes (doesn't matter if they were opened or not)
        $('#slickbox2').show('slide', 400); // and open one that was clicked
        return false;
    });
    

    This way you can extend your Like Us easily adding new items without writing .hide() for each opened/closed item.

    UPDATE: And if you need to close item if user again clicks on it, you can change show/hide section of the button .click() handler to the following.

    $('#slick-slidetoggle2').click(function() {
    
        if ( $('#slickbox2').is(':hidden') ) { // check if current box is hidden
            $('.slickbox').hide(); // hide all boxes (doesn't matter if they were opened or not)
            $('#slickbox2').show('slide', 400); // and open this one
        } else // if it was already opened
            $('#slickbox2').hide('slide', 400); // hiding the box
    
        return false;
    });
    

    :hidden selector will track the state of object visibility and basing on this you are deciding what to do with the box.

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

Sidebar

Related Questions

I have the jQuery below http://jsfiddle.net/XMdYw/7/ var elements = ''; var ELEMENT_COUNT_PER_PAGE = 301;
I have a jsFiddle that I am working with: http://jsfiddle.net/aL7Xe/77/ It all works great,
Currently I have a JQuery script in place http://jsfiddle.net/gaby/zzj7E/5/ which handles the requirement that
In the fiddle below I have two inline-block DIVs that are the same size.
I have: http://jsfiddle.net/Gkz4v/9/ .pagination li a { float: left; width: 6px; height: 6px; line-height:
I have a jsfiddle here : http://jsfiddle.net/hhimanshu/eLhLS/1/ Current: On keypress, it keeps on appending
I have a jsfiddle http://jsfiddle.net/4Pc4B/10/ . In the jsfiddle, type in a question in
i have done this http://jsfiddle.net/thilakar/WsxJy/3/ using with anchor tag and name attributes. but i
I have a form that has two parts to it. Yes or No. Yes
http://jsfiddle.net/nicktheandroid/ZSvHK/ I need help figuring out how to get this right, problems listed below.

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.