Calculate largest width of a set of elements using jQuery

后端 未结 7 1034
轻奢々
轻奢々 2020-12-16 03:07

I have made a quick Jsbin: http://jsbin.com/ujabew/edit#javascript,html,live

What i\'m trying to achieve is to find out which is the largest

7条回答
  •  -上瘾入骨i
    2020-12-16 04:02

    $(document).ready(function(){
      var maxWidth = 0;
      $('section').each(function(){
        w = $(this).outerWidth(true);      
        if ( w > maxWidth)
                maxWidth = w;
      });
    });
    

提交回复
热议问题