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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:00:34+00:00 2026-06-04T07:00:34+00:00

I have a site with 6 nav buttons down the side. For each of

  • 0

I have a site with 6 nav buttons down the side. For each of them, I want to show the corresponding DIV hide the other 5. The page loads with DIV #1 visible and the others display:none.

I know how to hide and show elements with hide(), show(), fade etc. but I am trying to come up with the best way to seamlessly show the clicked one while simultaneously hiding whichever one is currently visible, without resorting to spelling them all out like:

$('#btn1').click(function(){
$('#div2').hide();
$('#div3').hide();
$('#div1').show();
 )}
  • 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-04T07:00:34+00:00Added an answer on June 4, 2026 at 7:00 am

    Here is the jquery code:

          $(document).ready(function() {
              $('#btn-next').click(function () {
              $('#recent_post').hide();
               $('#top_post').fadeIn(3000).show();
               return false;        
                }); 
            $('#btn-prev').click(function () {
            $('#top_post').hide();
            $('#recent_post').fadeIn(3000).show();
                return false;   
            }); 
            });
    

    Here is the html:

        <div id="top_post" class="post" style="z-index:1;">
           <!---Content goes here--->
         </div>
        <div class="post" id="recent_post" style="display:none;z-index:0;">
           <!---Content goes here--->
         </div>
    

    I have implemented it in my website.Visit ‘articles’ section in http://kaidul.web44.net/
    I have just built it for two divs.Do the same work for 6 divs.Hope it works !

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

Sidebar

Related Questions

I have nav buttons on this site: http://www.dermatologypartners.com which have rounded corners, a gradient,
I have a site with a fixed header and fixed side nav, and scrolling
I have a site w/ an image gallery (Portfolio) page. There is drop-down navigation
I have a side nav that is importing the complete site nav and I'd
So i have a 'meganav' in my site that is essentially a side nav
I have nav a bar on my site but I want to put rounded
My intention is to have 4 main Nav-bars at a site. If the user
I Have site change.is, where right side menu & search bar in header is
I want to have site wide default settings for all jQuery validation uses on
I have a site that i want to redirect all requests accept for 1

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.