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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:25:03+00:00 2026-05-30T21:25:03+00:00

Hello All at StackOverflow, over the last few days I have had some problems

  • 0

Hello All at StackOverflow, over the last few days I have had some problems with my site and have got to a very comfortable point on where it is. My current jQuery script is:

jQuery(document).ready(function() { 
    $("#firstpagename, #firstpagename2").click(function () {
        $("div#white").toggle();
    });

    $("#secondpagename, #secondpagename2").click(function () {
        $("div#v2black").toggle();
    });

    $("#thirdpagename, #thirdpagename2").click(function () {
        $("div#v3black").toggle();
    });
});

I know this might not be the cleanest and best method, but it works and has had me going crazy over the past 5 days as I have only start using jQuery for a week now.

What I am trying to do now is to make the div’s white, v2black and v3black open; and when it does open, it closes any of the other div’s (see above) that might be open at the same time.

Here is my HTML incase it is needed for reference:

 <div class="altstevenav" style="display:none">
    <div class="stevenav">
        <ul class="navigation">
            <li>
                <a href="#firstpagename" id="firstpagename">Steve A</a>
            </li>
            <li>
                <a href="#secondpagename" id="secondpagename">Tattoos</a>
            </li>
            <li>
                <a href="#thirdpagename" id="thirdpagename">Sketchbook</a>
            </li>
        </ul>
    </div>
</div>
</div>
<!--MAIN CLOSING DIV-->
</div>
<!--CONTENT CLOSING DIV-->
    <div class="stevenav">
        <ul class="navigation">
            <li>
                <a href="#firstpagename" id="firstpagename2">Steve A</a>
            </li>
            <li>
                <a href="#secondpagename" id="secondpagename2">Tattoos</a>
            </li>
            <li>
                <a href="#thirdpagename" id="thirdpagename2">Sketchbook</a>
            </li>
        </ul>
    </div>

<!--ALL DIVS ARE CLOSE HERE-->
<!--Divisional Panels-->
<div id="white">
<div style="width:968px; margin: 0 auto;">
<div class="panel" style="color:#000000;">
<div style="width:450px; float:left;">
<img src="<?php echo the_field('image_one_of_biography'); ?>" width="425" alt="Biography Image" />
<br /><br />
<img src="<?php echo the_field('image_two_of_biography'); ?>" width="425" alt="Biography Image" />
<br /><br />
<img src="<?php echo the_field('image_three_of_biography'); ?>" width="425" alt="Biography Image" />
</div>
<div style="width:450px; float:left; text-align:left;">
<?php echo the_field('biography_content'); ?>
</div>
</div>
</div>
</div>
<div id="v2black">
<div style="width:968px; height:1000px; margin: 0 auto;">

</div>
</div>

<div id="v3black">
<div style="width:968px; height:1000px; margin: 0 auto;">

</div>
</div>

I would like to think this is pretty simple, but would just like a bit of direction of how I should go about this..

My question in a nut shell: Only one div open at one time out of white, v2black and v3black.

  • 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-30T21:25:04+00:00Added an answer on May 30, 2026 at 9:25 pm

    You could assign a common class and force them all closed on click then re-open the one you want…

    jQuery(document).ready(function() { 
        $("#firstpagename, #firstpagename2").click(function () {
            $('.common').hide();
            $("div#white").toggle();
        });
    
        $("#secondpagename, #secondpagename2").click(function () {
            $('.common').hide();
            $("div#v2black").toggle();
        });
    
        $("#thirdpagename, #thirdpagename2").click(function () {
            $('.common').hide();
            $("div#v3black").toggle();
        });
    });
    

    Then add the class to html…

    <div id="white" class="common">
    </div>
    <div id="v2black" class="common">
    </div>
    <div id="v3black" class="common">
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Few days ago I had to reinstall all my Linux system, and I also
Hello all you helpful folks @ stackoverflow! Best resources for Java GUI's? Looking at
hello all I have a small dialog which I created dynamically, which has a
Problem Hello all! I have this code which takes my jpg image loops through
Hello I know all about http://www.php.net/manual/en/function.http-build-query.php to do this however I have a little
Hello I have some javascript code, a script included inside my page. I want
Code can be found here: http://www.myhorizon.ca/client_central/sortable_test.php Hello folks of Stackoverflow, I have a list
Hello stackoverflow community, I am writing a batch file to do some automatic computer
Hello all Android Biggers! I am AndroMinor quite new to stackoverflow having only 6
https://stackoverflow.com/a/64983/468251 - Hello, I have question about this code, how made that working with

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.