Javascript/jQuery get true width and position of float affected element? -
is possible width (using javascript or jquery) of float-affected element? when text being pushed on due floating image possible position , true width? have attached image explain better.
code example,
<div>     <img style="...float: left"/>     <h1>a title!</h1>     <p>text!</p>     <h1>new header added.</h1> </div> i need find width starting arrow, (the gray box image)(the dotted line width according firefox inspect mode).
i avoid changing elements display types if possible. thank you!
first of all, "full width" true width.
you can watch picture, can understand why true width , true position of affected element way firefox tells you.
http://i.stack.imgur.com/mb5ds.png
to width of inline text it's pushed right float image, there's no way except using full width minus float image's width.
var w = $('p').width()          - $('img').width()          - $('img').css('margin-left').replace("px", "")         - $('img').css('margin-right').replace("px", "")         - $('img').css('padding-left').replace("px", "")         - $('img').css('padding-right').replace("px", "")         - $('img').css('border-left-width').replace("px", "")         - $('img').css('border-right-width').replace("px", ""); 
Comments
Post a Comment