jQuery min/max property from array of elements

前端 未结 8 1475
陌清茗
陌清茗 2020-11-29 02:09

Is there a simple way to find the min/max property from an array of elements in jQuery?

I constantly find myself dynamically resizing groups of elements based on the

8条回答
  •  长情又很酷
    2020-11-29 02:36

    You can use apply outside the context of OO, no need to extend the prototype:

    var maxHeight = Math.max.apply( null,
            $('img').map(function(){ return $(this).height(); }).get() );
    

提交回复
热议问题