Posted By

sherpa on 03/25/10


Tagged

width calculate overflow-x


Versions (?)

Calculate Width of Inner Divs


 / Published in: jQuery
 

For overflow-x, helpful to have total width of inner divs and set the parent. This uses jQuery 1.3.2

  1. //using jquery
  2.  
  3. var width = 0;
  4.  
  5. $('#id-of-container-element').each(function() {
  6. width += $(this).outerWidth( true );
  7. });
  8.  
  9. //optionally set the width of the container element
  10. $('#id-of-container-element').css('width', width);

Report this snippet  

You need to login to post a comment.