Can jquery reposition and resize divs

I have a page with a header, footer and middle area. Average - 3 identical columns, each - 33%.

When I click on a column, I would like this column to rise above the other two columns and get a width of 100%, and 2 columns to 50-50.

  • Is this possible (and reliable) with jquery, or is it too much trouble?
  • Can this be done with animation?
  • Any examples
+3
source share
2 answers

Yes, this can be done:

$("#column1").css("width", "100%");
$("#column2, #column3").css("width", "50%");

And to move the column at the top, you can do something like this:

$(column).parent().prepend(column);

I put together an example here in jsFiddle for how to do this when the div is clicked.

jQuery, , , -.

css .

+8

Source: https://habr.com/ru/post/1756583/


All Articles