|
61 | 61 | };
|
62 | 62 |
|
63 | 63 | /*
|
64 |
| - * $.fn.matchHeight |
| 64 | + * matchHeight |
65 | 65 | * plugin definition
|
66 | 66 | */
|
67 | 67 |
|
68 |
| - $.fn.matchHeight = function(byRow) { |
| 68 | + var matchHeight = $.fn.matchHeight = function(byRow) { |
69 | 69 |
|
70 | 70 | // handle matchHeight('remove')
|
71 | 71 | if (byRow === 'remove') {
|
|
75 | 75 | this.css('height', '');
|
76 | 76 |
|
77 | 77 | // remove selected elements from all groups
|
78 |
| - $.each($.fn.matchHeight._groups, function(key, group) { |
| 78 | + $.each(matchHeight._groups, function(key, group) { |
79 | 79 | group.elements = group.elements.not(that);
|
80 | 80 | });
|
81 | 81 |
|
|
91 | 91 | byRow = (typeof byRow !== 'undefined') ? byRow : true;
|
92 | 92 |
|
93 | 93 | // keep track of this group so we can re-apply later on load and resize events
|
94 |
| - $.fn.matchHeight._groups.push({ |
| 94 | + matchHeight._groups.push({ |
95 | 95 | elements: this,
|
96 | 96 | byRow: byRow
|
97 | 97 | });
|
98 | 98 |
|
99 | 99 | // match each element's height to the tallest element in the selection
|
100 |
| - $.fn.matchHeight._apply(this, byRow); |
| 100 | + matchHeight._apply(this, byRow); |
101 | 101 |
|
102 | 102 | return this;
|
103 | 103 | };
|
|
106 | 106 | * plugin global options
|
107 | 107 | */
|
108 | 108 |
|
109 |
| - $.fn.matchHeight._groups = []; |
110 |
| - $.fn.matchHeight._throttle = 80; |
111 |
| - $.fn.matchHeight._maintainScroll = false; |
112 |
| - $.fn.matchHeight._beforeUpdate = null; |
113 |
| - $.fn.matchHeight._afterUpdate = null; |
| 109 | + matchHeight._groups = []; |
| 110 | + matchHeight._throttle = 80; |
| 111 | + matchHeight._maintainScroll = false; |
| 112 | + matchHeight._beforeUpdate = null; |
| 113 | + matchHeight._afterUpdate = null; |
114 | 114 |
|
115 | 115 | /*
|
116 |
| - * $.fn.matchHeight._apply |
| 116 | + * matchHeight._apply |
117 | 117 | * apply matchHeight to given elements
|
118 | 118 | */
|
119 | 119 |
|
120 |
| - $.fn.matchHeight._apply = function(elements, byRow) { |
| 120 | + matchHeight._apply = function(elements, byRow) { |
121 | 121 | var $elements = $(elements),
|
122 | 122 | rows = [$elements];
|
123 | 123 |
|
|
208 | 208 | $hiddenParents.css('display', '');
|
209 | 209 |
|
210 | 210 | // restore scroll position if enabled
|
211 |
| - if ($.fn.matchHeight._maintainScroll) |
| 211 | + if (matchHeight._maintainScroll) |
212 | 212 | $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
|
213 | 213 |
|
214 | 214 | return this;
|
215 | 215 | };
|
216 | 216 |
|
217 | 217 | /*
|
218 |
| - * $.fn.matchHeight._applyDataApi |
| 218 | + * matchHeight._applyDataApi |
219 | 219 | * applies matchHeight to all elements with a data-match-height attribute
|
220 | 220 | */
|
221 | 221 |
|
222 |
| - $.fn.matchHeight._applyDataApi = function() { |
| 222 | + matchHeight._applyDataApi = function() { |
223 | 223 | var groups = {};
|
224 | 224 |
|
225 | 225 | // generate groups by their groupId set by elements using data-match-height
|
|
240 | 240 | };
|
241 | 241 |
|
242 | 242 | /*
|
243 |
| - * $.fn.matchHeight._update |
| 243 | + * matchHeight._update |
244 | 244 | * updates matchHeight on all current groups with their correct options
|
245 | 245 | */
|
246 | 246 |
|
247 | 247 | var _update = function(event) {
|
248 |
| - if ($.fn.matchHeight._beforeUpdate) |
249 |
| - $.fn.matchHeight._beforeUpdate(event, $.fn.matchHeight._groups); |
| 248 | + if (matchHeight._beforeUpdate) |
| 249 | + matchHeight._beforeUpdate(event, matchHeight._groups); |
250 | 250 |
|
251 |
| - $.each($.fn.matchHeight._groups, function() { |
252 |
| - $.fn.matchHeight._apply(this.elements, this.byRow); |
| 251 | + $.each(matchHeight._groups, function() { |
| 252 | + matchHeight._apply(this.elements, this.byRow); |
253 | 253 | });
|
254 | 254 |
|
255 |
| - if ($.fn.matchHeight._afterUpdate) |
256 |
| - $.fn.matchHeight._afterUpdate(event, $.fn.matchHeight._groups); |
| 255 | + if (matchHeight._afterUpdate) |
| 256 | + matchHeight._afterUpdate(event, matchHeight._groups); |
257 | 257 | };
|
258 | 258 |
|
259 |
| - $.fn.matchHeight._update = function(throttle, event) { |
| 259 | + matchHeight._update = function(throttle, event) { |
260 | 260 | // prevent update if fired from a resize event
|
261 | 261 | // where the viewport width hasn't actually changed
|
262 | 262 | // fixes an event looping bug in IE8
|
|
274 | 274 | _updateTimeout = setTimeout(function() {
|
275 | 275 | _update(event);
|
276 | 276 | _updateTimeout = -1;
|
277 |
| - }, $.fn.matchHeight._throttle); |
| 277 | + }, matchHeight._throttle); |
278 | 278 | }
|
279 | 279 | };
|
280 | 280 |
|
|
283 | 283 | */
|
284 | 284 |
|
285 | 285 | // apply on DOM ready event
|
286 |
| - $($.fn.matchHeight._applyDataApi); |
| 286 | + $(matchHeight._applyDataApi); |
287 | 287 |
|
288 | 288 | // update heights on load and resize events
|
289 | 289 | $(window).bind('load', function(event) {
|
290 |
| - $.fn.matchHeight._update(false, event); |
| 290 | + matchHeight._update(false, event); |
291 | 291 | });
|
292 | 292 |
|
293 | 293 | // throttled update heights on resize events
|
294 | 294 | $(window).bind('resize orientationchange', function(event) {
|
295 |
| - $.fn.matchHeight._update(true, event); |
| 295 | + matchHeight._update(true, event); |
296 | 296 | });
|
297 | 297 |
|
298 | 298 | })(jQuery);
|
0 commit comments