Monday, 15 June 2015

jquery - Javascript: Getting the width of child-elements -



jquery - Javascript: Getting the width of child-elements -

i have 2 stacked divs.

the outer div has fixed width overflow hidden.

the inner div has content in total can larger outher div.

how can total width of content of inner div?

<div id='outer' style='width:100px'> <div id='inner'> content </div> </div>

when seek $('#inner').width() , content larger outer, homecoming width of outer div.

i using chrome.

http://jsfiddle.net/4syej/

you can .scrollwidth of parent, homecoming want.

document.getelementbyid('outer').scrollwidth

http://jsfiddle.net/4syej/3/

javascript jquery html css width

No comments:

Post a Comment