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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:43:06+00:00 2026-06-15T19:43:06+00:00

I am setting up a page which the user can hide the side bar

  • 0

I am setting up a page which the user can hide the side bar if they wish. I am trying to use the jqeuryui to do this with the following js code

// TOGGLE JS
$(function () {      
    function runEffect() {           
        var options = {};            
        $("#effect").toggle('slide', options, 500);
    };
    $("#button").click(function () {
        runEffect();
        return false;
    });
}); 

I have this working in a JSFiddle here http://jsfiddle.net/jwg4U/

However, when you look at the JSFiddle you will notice that my main content area which is a DIV called #content does not animate, it just jumps into place when I toggle the sidebar.

I would like the content div to also slide into place seamlessly and follow the toggle as it if it attached to it.

I have looked at jquery animate, but not sure how to implement this with the slide?


A Second part I am struggling with is how to change the button text when the sidebar is closed to say “Show Sidebar” – Weather it is open or closed right now it just says “Hide Sidebar”

Looking for some help

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-15T19:43:07+00:00Added an answer on June 15, 2026 at 7:43 pm

    See this updated fiddle : http://jsfiddle.net/jwg4U/23/

    HTML:

    <div id="container" style="width:800px">
    
    <div id="header">
         <h1>HEADER</h1>
    </div>
    
    <div class="toggler">
    <div id="effect" class="ui-widget-content ui-corner-all">
        <div id="menu" style="background-color:#FFD700;height:300px;width:100px;float:left;">
            <h3>SIDEBAR</h3>
        </div>
    </div>
    
    
    <div id="content" style="background-color:#EEEEEE;height:300px;">Main Content goes     here</div>
    </div>
    <a href="#" id="button" class="ui-state-default ui-corner-all">Hide Sidebar</a>
    
    <div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
    FOOTER</div>
    
    </div>
    

    ​

    JS:

    // TOGGLE JS
    $(function() {
    var i = 0;
    
    function runEffect() {
        var options = {};
        if (i === 0) {
            i = 1;
            $(".toggler").animate({
                left: -100
            }, {
                duration: 500
            });
        }
        else {
            i = 0;
            $(".toggler").animate({
                left: 0
            }, {
                duration: 500
            });
        }
    }
    $("#button").click(function() {
        if (i === 0) {
            $(this).html("Show Sidebar");
        }
        else {
            $(this).html("Hide Sidebar");
        }
        runEffect();
        return false;
    });
    });
    
    // TABS JS
    $(function() {
    $("#tabs").tabs();
    });​
    

    CSS:

     .toggler {
        float: left;
        position: relative;
    }
    #button {
        padding: .5em 1em;
        text-decoration: none;
    }
    #effect {
        position: relative;
        float: left;
    }
    #content{
        position: relative;
        float: left;
        width: 500px;
    }
    #button{
        float: left;
        clear: both;
    }
    #header{
        background-color: #000;
        color: #FFF;
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a use case where I am setting the page focus to a
I made a settings page for my website. On this page the user is
I had a web page in which the user specify an username and a
How can I unset SESSION['variables'] when user is leaving a page, without having to
We have a website that has a common logon page. A user chooses which
I'm setting up a payment gateway for my software product which users can buy
We have an ASP app that's sitting in an iframe on a page which
Assume I have a such json setting: { page:1, items:[ { name: 'item1', id:1
Im having dificulty in setting the root page in may Rails app to the
If i have a HTML page with setting to be UTF-8. and then I

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.