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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:50:03+00:00 2026-06-14T16:50:03+00:00

So I have 3 div columns (33% width each) and I’m trying to set

  • 0

So I have 3 div columns (33% width each) and I’m trying to set it up so that once any column is clicked on, it will expand to 100% width and at the same time, overlap the two columns next to it.

I know it’s something to do with z-index and positioning of the divs but I guess it needs to be added to the Jquery rather than the CSS?

The left div is overlapping the middle and right divs on click, but can’t get the other two to do the equivalent. On click, they stretch to 100% but drop below the left column and don’t overlap. See the fiddle…

Fiddle here – http://jsfiddle.net/PGRAr/7/

Here’s the Jquery that stretches the column on click:

$('#divleft, #divmid, #divright').toggle(function(){
$(this).animate({height:'200', width: '100%'})
}, function() {
$(this).animate({height:'200', width: '33.3%'})
})

And here’s the CSS:

#divleft{
width:33.3%;
height:200px;
background:#ccc;
margin-top: 10px;
float: right;
position: absolute;
}

#divmid{
width:33.3%;
height: 200px;
background: #696;
margin-top: 10px;
float: right;
}

#divright{
width:33.3%;
height:200px;
background:#000;
margin-top: 10px;
float: right;  
}

Left column works perfectly, I just need to create the same effect for the middle and right columns…

Thanks!

  • 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-14T16:50:04+00:00Added an answer on June 14, 2026 at 4:50 pm

    I had to do some minor modifications to your CSS and added some JS, but this should get you started.

    $('#divleft, #divmid, #divright').toggle(function () {
    
        //Set a base config option that you can modify
        var cfg = { height: '200', width: '100%' };
    
        //Set current element as top-most div
        $(this).css({ 'z-index': 100 });
    
        //Get the pct of the current element and switch based on it.
        var pct = $(this).css('left').split('p')[0] / $(document).width();
        if (pct <= .33 && pct > 0) {
            cfg.left = '0';
            $(this).data('oldLeft', "33%");
        } else if (pct <= .66 && pct > .33) {
            cfg.left = '0';
            $(this).data('oldLeft', "66%");
        }
        $(this).animate(cfg)
    }, function () {
        var cfg = { height: '200', width: '33%', 'z-index': 1 };
        if ($(this).data('oldLeft')) {
            console.log($(this).data('oldLeft'));
            cfg.left = $(this).data('oldLeft');
        }
        $(this).animate(cfg)
    })
    

    Here is the working fiddle

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

Sidebar

Related Questions

I have these div blocks called columns where each column div contains separate two
I want a two-column div layout, where each one can have variable width e.g.
I have a dynamic table with each row having 4 columns. Column 1 has
I have a div which contains 3 columns (each as a div). The problem
I have the age-old problem of a div wrapping a two-column layout. My sidebar
I have a 3 column layout using table-less design. <div id=main> <div id=left></div> <div
I have div ( #child ) which won't expand to the full height of
I have a table, with 10 columns. I want to control the width of
I have the following 2 column div layout. The left column needs to have
I have a table with multiple rows and columns and each cell contains a

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.