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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:43:03+00:00 2026-06-03T11:43:03+00:00

I have a layout with two divs inside a container, here’s a JSFiddle of

  • 0

I have a layout with two divs inside a container, here’s a JSFiddle of the layout. I want to animate the right column off the display, and have the left column adjust to 100% width to fill the newly created space. This is the jQuery code I have:

if ($('div#right').offset().left > $('#container').width()) {
         // Bring right-column back onto display

          $('div#right').animate({
            left:'0'
          }, 600);

          $('div#left').animate({
            width:'50%'
          }, 200);
        } else {

// Animate column off display.
          $('div#right').animate({
            left:'+50%'
          }, 600);

          $('div#left').animate({
            width:'100%'
          }, 1000);
        } 

container overflow-x is set to hidden. The problem I’m having is that expanding the left column to 100% causes the right column to appear beneath the left column, since it still takes up space within the container, and the left column is gradually moving toward taking up 100% of the container’s width.

Any suggestions about how to achieve this?

  • 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-03T11:43:06+00:00Added an answer on June 3, 2026 at 11:43 am
     $('#container').click(function(){
        if (parseInt($('div#right').css('right'),10) < 0) {
                 // Bring right-column back onto display
                  $('div#right').animate({
                      right:'0%'
                  }, 1000);
    
                  $('div#left').animate({
                    width:'45%'
                  }, 600);
                } else {
    
        // Animate column off display.
                  $('div#right').animate({
                      right:'-45%'
                  }, 600);
    
                  $('div#left').animate({
                    width:'100%'
                  }, 1000);
        }
    

    });

    This is a better solution. Use absolute positioning instead of floats: jsFiddle: http://jsfiddle.net/YNAJZ/38/

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

Sidebar

Related Questions

I want to make a two column layout using DIVs, where right column will
I want a two-column div layout, where each one can have variable width e.g.
I have the following scenario: a two column layout made up of divs A
I have a two-column layout with two 'absolute' positioned divs. #left { position: absolute;
I have this section and, for layout proposes I would need two divs inside
I have a MasterPage that is two column layout, left column menu, right column
I have a simple page layout with two divs--one on top, and one on
I have a layout that contains two ImageViews. I want one of them to
I have the age-old problem of a div wrapping a two-column layout. My sidebar
I have two layouts, one is the main layout inside which I am including

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.