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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:10:34+00:00 2026-05-28T16:10:34+00:00

I have a <div> , divided into 3 <div> s. Two of those divs

  • 0

I have a <div>, divided into 3 <div>s. Two of those divs are taken as previous and next buttons, having ids prev and next respectively. 3 <div>s having ids diva, divb, and divc are arranged on the bottom. divb and divc have 0 width so that they are hidden and only diva is visible. I want to hide diva to hide (set width to 0) and divb to appear when user click id=next and if the button is clicked again, I want divb to hide and divc to appear. Also I want this to happen reverse if id=prev is clicked.

Below is an image of what I am trying to say;

enter image description here

Here is the fiddle.

  • 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-28T16:10:35+00:00Added an answer on May 28, 2026 at 4:10 pm

    I used class to implement what you need. Check DEMO here

    Full code:

    var $pages = $('.page');
    $('#nxt').click(
      function() {
        var $cur = $('.active');       //get current active
        var $next = $cur.next();       //get next to cur
    
        /*
         * Add logic inside below if condition for going 
         * back to first div.
        */
        if ($next.length == 0) return; //if nothing in next, return.
    
        $cur.removeClass('active');    //remove active class from cur active
        $next.addClass('active');      //add next as current active
    
        //animate everything except .active (which is next)
        $('.page').not('.active').animate({"width": 0}, "slow"); 
    
        //animate cur (which was next) 
        $('.active').animate({"width": 200}, "slow");
    });
    
    $('#prev').click(
      function() {
        var $cur = $('.active');
        var $prev = $cur.prev('.page');
    
        if ($prev.length == 0) return;
    
        $cur.removeClass('active');
        $prev.addClass('active');
    
        $('.page').not('.active').animate({"width": 0}, "slow");
        $('.active').animate({"width": 200}, "slow");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

.I have a div tag that is also divided into two divs. here is
I have a div that is divided into two parts. left and right. it
I have my screen divided into two DIV s. In the left DIV I
I have a problem in HTML. I have divided the HTML page into two
I wish to have html page divided into two rows of 50% each. For
I have div which has three buttons as, <div id=buttons> <input id=preview class=ButtonStyle type=submit
Suppose I have div and I want to fetch data and push data into
i'm attempting to create an header which is divided into 3 divs they will
I have divided form in to two sections: sec1 and sec2 . Each section
I have an ASP.NET page in a frameset. I divided into 2 frames, 1.LEFTNAVI

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.