Skip to content Skip to sidebar Skip to footer

Toggle Two Divs Percentage Width With One Button

i want to toggle the width of two divs with one button as seen on: http://www.ulrichshusen.de The menu on top shrinks while the left area is shown. And it expands while the left a

Solution 1:

$(document).ready(function(){
 $('**button class here**').click(function(){
   $('div to be resized').toggle();
   $('div to be resized').toggle();
   )};
});

Here is to add class and remove class

$(document).ready(function(){
 $('**button class here**').click(function(){
   $(this).sibling().removeClass().addClass();
   )};
 });

This should help you get started in the right direction. You will probably need some if statements added and or current states of each, but Christian Varga is correct it would be simple to do .addClass then add the class of what the div state should be. Hope this gets you started.

Solution 2:

Actually there was no connection between top nav and the button you click to toggle left section. The button only controls left section. I did some work for you to understand. Follow the link below:

http://jsfiddle.net/sanman/LveSp/

Post a Comment for "Toggle Two Divs Percentage Width With One Button"