jQuery,获取一个元素的宽度并应用于另一元素 [英] jQuery, get width of one element and apply to another
本文介绍了jQuery,获取一个元素的宽度并应用于另一元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以获取例如一个元素.container
的宽度并将其应用于另一个.item
的宽度?
Is there a way that I can get the width of one element .container
for example and apply it to another .item
for example?
我的布局是响应式的,因此为什么不能只给.item
一个固定的宽度值.
My layout is responsive, hence why I can't just give .item
a fixed width value.
推荐答案
类似-
$('.item').width($('.container').width());
演示---->
http://jsfiddle.net/xQ7hh/
这篇关于jQuery,获取一个元素的宽度并应用于另一元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文