开发者

Width of the parent container with jquery

开发者 https://www.devze.com 2023-03-27 04:36 出处:网络
How can I set \"DOP_ThumbnailGallery_Container开发者_Go百科\" to have the width of the parent container

How can I set "DOP_ThumbnailGallery_Container开发者_Go百科" to have the width of the parent container

$('.DOP_ThumbnailGallery_Container', Container).width($(Container).width());

I tried this way /\ but it doesn't work, it gives the width of the window;

I even tried to have the outer container with overflow hidden, but it breaks it!


Or something like ...

http://jsfiddle.net/y3597/2/

$('#object').width($('#object').parent().width());


Have you looked at the parents function of jquery?

You can do something like this:

$('.DOP_ThumbnailGallery_Container').width($('.DOP_ThumbnailGallery_Container').parents("div").width());

source: http://api.jquery.com/parents/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号