mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Bring and require equalize from spree_backend
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
//= require admin/spree_backend
|
||||
//= require modernizr
|
||||
//= require spin
|
||||
//= require equalize
|
||||
//= require css_browser_selector_dev
|
||||
//= require responsive-tables
|
||||
//= require admin/spree_paypal_express
|
||||
|
||||
41
vendor/assets/javascripts/equalize.js
vendored
Normal file
41
vendor/assets/javascripts/equalize.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* equalize.js
|
||||
* Author & copyright (c) 2012: Tim Svensen
|
||||
* Dual MIT & GPL license
|
||||
*
|
||||
* Page: http://tsvensen.github.com/equalize.js
|
||||
* Repo: https://github.com/tsvensen/equalize.js/
|
||||
*
|
||||
* The jQuery plugin for equalizing the height or width of elements.
|
||||
*
|
||||
* Equalize will accept any of the jQuery Dimension methods:
|
||||
* height, outerHeight, innerHeight,
|
||||
* width, outerWidth, innerWidth.
|
||||
*
|
||||
* EXAMPLE
|
||||
* $('.parent').equalize(); // defaults to 'height'
|
||||
* $('.parent').equalize('width'); // equalize the widths
|
||||
*/
|
||||
(function($, window, document, undefined) {
|
||||
|
||||
$.fn.equalize = function(equalize) {
|
||||
var $containers = this, // this is the jQuery object
|
||||
equalize = equalize || 'height',
|
||||
type = (equalize.indexOf('eight') > 0) ? 'height' : 'width';
|
||||
|
||||
if (!$.isFunction($.fn[equalize])) { return false; }
|
||||
|
||||
return $containers.each(function() {
|
||||
var $children = $(this).children(),
|
||||
max = 0; // reset for each container
|
||||
|
||||
$children.each(function() {
|
||||
var value = $(this)[equalize](); // call height(), outerHeight(), etc.
|
||||
if (value > max) { max = value; } // update max
|
||||
});
|
||||
|
||||
$children.css(type, max +'px'); // add CSS to children
|
||||
});
|
||||
};
|
||||
|
||||
}(jQuery, window, document));
|
||||
Reference in New Issue
Block a user