Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery, determine object position using component width

i want to put the position of inner div with using:

 <div id="outerdiv">
     <div id="innerdiv1" style="position:absolute;width:30px;"
     <div id="innerdiv2" style="position:absolute;left:20px;"

The problem is width of innerdiv1 can be changed dynamically, i want that div2 is near to div1, i calculate its position using outerdiv1.left + innerdiv1.innerwidth, but there is always some offset and innerdiv2 is not exactly put to innerdiv1? What can be the reason?


1 Answers

try using component.outerWidth instead of component.width, it will give the exact result.

like image 55
benchpresser Avatar answered Jun 30 '26 14:06

benchpresser