admin管理员组文章数量:1406951
I have a page with a header, footer, and middle area. The middle is 3 equal columns, each 33% width.
When a column is clicked, I'd like for that column to climb above the 2 other columns and get a width of 100%, and the 2 columns to redistribute to 50-50.
- Is this sort of thing possible (and reliable) with jquery, or is it too much of a hassle?
- Can it be done with animations?
- Any examples
I have a page with a header, footer, and middle area. The middle is 3 equal columns, each 33% width.
When a column is clicked, I'd like for that column to climb above the 2 other columns and get a width of 100%, and the 2 columns to redistribute to 50-50.
- Is this sort of thing possible (and reliable) with jquery, or is it too much of a hassle?
- Can it be done with animations?
- Any examples
- 3 equal columns. When 1 is made 100%, wouldn't that throw other 2 to next row ?? What you asked, is definitely answered by GenericTypeTea, but column1 wont climb over other 2. It will throw it others out. You have to set some ratios. – simplyharsh Commented Jul 26, 2010 at 15:00
- @harshh - Have a look at the jsFiddle I provided. Seems to work alright. – djdd87 Commented Jul 26, 2010 at 15:08
2 Answers
Reset to default 8Yes it can be done:
$("#column1").css("width", "100%");
$("#column2, #column3").css("width", "50%");
And to move the column to the top, you can do something like this:
$(column).parent().prepend(column);
I've put together an example here on jsFiddle for how to do it on the click of the div.
jQuery is probably the most reliable way to do it as it's written to be cross browser patible.
Take a look at the document for the css method here.
http://docs.jquery./Tutorials:Live_Examples_of_jQuery
Check out example B as I think that's what you're looking for. I don't have a lot of experience myself with jQuery so unfortunately this is the best advice I'm going to be able to give you.
本文标签: javascriptCan jquery reposition and resize divsStack Overflow
版权声明:本文标题:javascript - Can jquery reposition and resize divs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744891372a2630802.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论