0

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 area isn't shown.

How can i accomplish this with jquery?

  • 5
    Welcome to StackOverflow. We are happy to help you with specific problems relating to your code, but we will not (in most cases) write the code for you. Will you show us your markup and your attempts and tell us what isn't working in your current code? – George Cummins Apr 30 '13 at 14:53
  • Also, this can be accomplished purely using CSS (just using js to toggle the classes). – Christian Apr 30 '13 at 14:58

2 Answers2

0
$(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.

Cam
  • 1,884
  • 11
  • 24
0

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/
sanman
  • 57
  • 3