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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:47:29+00:00 2026-05-26T19:47:29+00:00

I am trying to do a basic div layout and would like to use

  • 0

I am trying to do a basic div layout and would like to use plain javascript or jquery to mimic the functionality on this page
http://octopress.org/blog/archives/

There is a content wrapper div and a left article column and a right sidebar column. There is also a skinny div in-between the left and right div that can be clicked on, once clicked on, it either closes or expands the right side div.

The page flow…

1) On page load the right side div should be open.

2)
Once you click the middle div it closes the right side div and expands the left side div’s width to cover the space of the left + right side div. The middle div still is visibable, so you can click it again to expand the div back out

3) Also once you click the middle div to collaps the right side div, it collapses it, but it also puts the contents of that div, underneith the left main column div. Like the right side div I think has a float:left valuse so once the left div is expanded, it will push that div down underneith the left div

4) With right side div collapsed, you can click the middle div which is now hugging the right side border of the main div wrapper, it will then resive the left div back down small to allow the right div to fit back into place again

It probably sounds more complicated then it is to describe what I am looking to do, if you view the link though http://octopress.org/blog/archives/ it does exactly what I am talking about.

I have tried disecting the page and rebuilding just the part I am after without any luck, I would really appreciate any help in a doing this with jquery, as well as how to do the css for the divs.

I have seen some plugins that do similar work but not the same, please help if you can

Here are some screen shots of the different phases I am after…

enter image description here

enter image description here

I appears that I just need to have the javascript add and remove some css rules when the middle div is clicked.

  • 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-26T19:47:30+00:00Added an answer on May 26, 2026 at 7:47 pm

    the key for the layout is to use negative margin on the sidebar.

    You could see the simplified layout example here:

    http://jsfiddle.net/9FUQA/

    The html

    <div id="wrapper">
      <div id="content">
        <div class="left_column"></div>
        <div class="right_column"></div>
        <span class="toggle_sidebar"></span>
      </div>
    </div>
    

    The CSS. First you float both column, and you set the width on the right column and a 100% nagetive margin-right to bring the right column onto the same line as the left-column.

    On collapse, you remove both the float and negative margin-right on right-column, and it falls into the normal block flow.

    #content {
      width:500px;
      margin-right:200px;
      position:relative;
    }
    
    .left_column {
      width:100%;
      float:left;
    
    }
    
    .right_column {
      width:160px;
      padding:0 20px;
      margin:0 -100% 0 0;
      float:left;
    }
    
    .toggle_sidebar {
      position:absolute;
      top:0;
      bottom:0;
      right:-10px;
    
    }
    
    .collapse .right_column {
      float: none;
      width: auto;
      clear: left;
      margin: 0;
    }
    
    .collapse #content {
      margin-right:20px;
    }
    .collapse .toggle_sidebar {
      right: -20px;
      width: 19px;
    }
    

    The JS

    $(document).ready(function () {
      $('.toggle_sidebar').click(function(event) {
          $('#wrapper').toggleClass('collapse');
      });
    }); 
    

    You could see the simplified layout example here:

    http://jsfiddle.net/9FUQA/

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

Sidebar

Related Questions

I am trying to learn and use html5 and have a basic layout but
I can't use the basic $('#div').html(value); to change the text of a div like
Basic jQuery question: I am trying to reveal a div that has been marked
I am trying to create some basic button rollover functionality using Jquery and toggleClass.
I am trying to use a very basic smooth scrolling feature with jQuery's scrollTop
This is my first post. I'm trying to do some basic meta-programming with javascript,
I'm trying a very basic XPath on this xml (same as below), and it
I'm trying to put together this layout... ... but I'm having issues with the
I am trying to display a basic 4 block layout to the centre of
I'm trying something very basic, but I just can't figure out why this won't

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.