jQuery,获取一个元素的宽度并应用于另一元素 [英] jQuery, get width of one element and apply to another

查看:53
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆