Calculate largest width of a set of elements using jQuery

后端 未结 7 1051
轻奢々
轻奢々 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条回答
  •  青春惊慌失措
    2020-12-16 03:51

    Change the .each() loop to this:

    var thisWidth = $(this).outerWidth(true);
    
    if (thisWidth > width) {
        width = thisWidth;
    }
    

提交回复
热议问题