开发者

Width of the parent container with jquery

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜