jquery-minmax

Created: 2013-01-01 18:29
Updated: 2014-03-11 15:29
License: mit

README.md

jQuery MinMax Plugin

Find smallest and largest value in array of numbers or collection of elements.

Description

This is another jQuery implementation of min/max technique which was mentioned by John Resig some time ago in his Fast JavaScript Max/Min blog post. Since then it has spread around the web, but unfortunately, I couldn't find version that would iterate over the collection and return element based on its largest or smallest property value. That's the purpose of this plugin.

Usage

// Find smallest in array of numbers
var smallest = $.min([ 12, 2, -12, 5, 9 ]); // -12

// Retrieve collection of columns
var columns = $( '.columns' );

// Find the tallest column height
var maxHeight = columns.max(function () {
  return $( this ).height();
});

// Set equal column height
columns.height( maxHeight );

License

Copyright (c) 2013 Anton Yefremov
Free to use and abuse under the MIT license.
http://opensource.org/licenses/MIT

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more