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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:08:36+00:00 2026-05-31T20:08:36+00:00

Here is jsfiddle ! I am trying to make user page where he can

  • 0

Here is jsfiddle !

I am trying to make user page where he can switch between pages by clicking on div’s. Problem is, I will need more then 3 div’s , and this already is very messy…

<div id="dviOverdivWraper">
    <div class="containterBox">
        <div id="leftOver" style="background-color:blue">
        </div>
        <div id="rightOver" style="background-color:red">
        </div>
        <div id="thirdOver" style="background-color:yellow">
        </div>
    </div>
</div>
#dviOverdivWraper {
    width: 800px;
    height: 400px;
    margin: 0px auto;
    top: 200px;
    text-align:center;
}
#dviOverdivWraper .containerBox{
    width: 800px;
    height: 400px;
    margin: 0px auto;
    text-align:center;
}
#leftOver{
    width: 400px;
    height: 200px;
    float: left;
}
#rightOver, #thirdOver{
    width: 50px;
    height: 200px;
    float: left;
}
$("#rightOver").click(function () {
    $("#leftOver").animate({
        width: "50px"
    }, 500, null);
    $("#rightOver").animate({
        width: "400px"
    }, 500, null);
    $("#thirdOver").animate({
        width: "50px"
    }, 500, null);
});
$("#leftOver").click(function () {
    $("#rightOver").animate({
        width: "50px"
    }, 500, null);
    $("#leftOver").animate({
        width: "400px"
    }, 500, null);
    $("#thirdOver").animate({
        width: "50px"
    }, 500, null);
});
$("#thirdOver").click(function () {
    $("#rightOver").animate({
        width: "50px"
    }, 500, null);
    $("#leftOver").animate({
        width: "50px"
    }, 500, null);
    $("#thirdOver").animate({
        width: "400px"
    }, 500, null);
});

How can I optimize it, because I will need more then 3 div’s?

  • 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-31T20:08:37+00:00Added an answer on May 31, 2026 at 8:08 pm

    jsFiddle DEMO

        // SET MIN WIDTH:
        var minW = 50;
        // SET MAX WIDTH:
        var maxW = 400;
        // SET INITIALLY OPENED BOX:
        var openBox = 1;
        // SET ANIMATION SPEED (in milliseconds)
        var speed = 400;
        //////////////////////
          
    $('.box').eq(openBox-1).width(maxW).siblings().width(minW); // initial setup
    
    function animate(){
       $('.box').eq(openBox).stop().animate({width: maxW},speed).siblings().animate({width: minW},speed);            
    }
        
    $('.box').on('click', function(){
       openBox = $(this).index();
       animate();                    
    });
    

    P.S: I just added a class .box to your elements.

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

Sidebar

Related Questions

I'm currently trying to make a button which will take the user back to
Please review the fiddle here for an example: http://jsfiddle.net/TKJsc/1/ Basically i'm trying to make
I'm trying to make a menu using tags, and you can see it here,
Here is my JSfiddle document: http://jsfiddle.net/TSM_mac/xXcZx/1/ Basically, I am trying to make the second
You can see the implementation here: http://jsfiddle.net/kqKfK/ I am trying to get everything in
I'm trying to make a full screen slideshow kind of effect jsFiddle code here
I'm trying to make my DIV background loop between 3 images. I have a
Trying to make a text ... loading animation here's where I stand: http://jsfiddle.net/aGfct/ I
I've got a problem which you can look at here http://jsfiddle.net/dng2P/4/ If you click
Here's the code I'm currently working with: http://jsfiddle.net/gEMCm/ I'm trying to make an image

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.