@@ 2501-2616 (lines=116) @@ | ||
2498 | ||
2499 | })(UIkit2); |
|
2500 | ||
2501 | (function(UI) { |
|
2502 | ||
2503 | "use strict"; |
|
2504 | ||
2505 | var grids = []; |
|
2506 | ||
2507 | UI.component('gridMatchHeight', { |
|
2508 | ||
2509 | defaults: { |
|
2510 | target : false, |
|
2511 | row : true, |
|
2512 | ignorestacked : false, |
|
2513 | observe : false |
|
2514 | }, |
|
2515 | ||
2516 | boot: function() { |
|
2517 | ||
2518 | // init code |
|
2519 | UI.ready(function(context) { |
|
2520 | ||
2521 | UI.$('[data-uk-grid-match]', context).each(function() { |
|
2522 | var grid = UI.$(this), obj; |
|
2523 | ||
2524 | if (!grid.data('gridMatchHeight')) { |
|
2525 | obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match'))); |
|
2526 | } |
|
2527 | }); |
|
2528 | }); |
|
2529 | }, |
|
2530 | ||
2531 | init: function() { |
|
2532 | ||
2533 | var $this = this; |
|
2534 | ||
2535 | this.columns = this.element.children(); |
|
2536 | this.elements = this.options.target ? this.find(this.options.target) : this.columns; |
|
2537 | ||
2538 | if (!this.columns.length) return; |
|
2539 | ||
2540 | UI.$win.on('load resize orientationchange', (function() { |
|
2541 | ||
2542 | var fn = function() { |
|
2543 | if ($this.element.is(':visible')) $this.match(); |
|
2544 | }; |
|
2545 | ||
2546 | UI.$(function() { fn(); }); |
|
2547 | ||
2548 | return UI.Utils.debounce(fn, 50); |
|
2549 | })()); |
|
2550 | ||
2551 | if (this.options.observe) { |
|
2552 | ||
2553 | UI.domObserve(this.element, function(e) { |
|
2554 | if ($this.element.is(':visible')) $this.match(); |
|
2555 | }); |
|
2556 | } |
|
2557 | ||
2558 | this.on('display.uk.check', function(e) { |
|
2559 | if(this.element.is(':visible')) this.match(); |
|
2560 | }.bind(this)); |
|
2561 | ||
2562 | grids.push(this); |
|
2563 | }, |
|
2564 | ||
2565 | match: function() { |
|
2566 | ||
2567 | var firstvisible = this.columns.filter(':visible:first'); |
|
2568 | ||
2569 | if (!firstvisible.length) return; |
|
2570 | ||
2571 | var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100; |
|
2572 | ||
2573 | if (stacked && !this.options.ignorestacked) { |
|
2574 | this.revert(); |
|
2575 | } else { |
|
2576 | UI.Utils.matchHeights(this.elements, this.options); |
|
2577 | } |
|
2578 | ||
2579 | return this; |
|
2580 | }, |
|
2581 | ||
2582 | revert: function() { |
|
2583 | this.elements.css('min-height', ''); |
|
2584 | return this; |
|
2585 | } |
|
2586 | }); |
|
2587 | ||
2588 | UI.component('gridMargin', { |
|
2589 | ||
2590 | defaults: { |
|
2591 | cls : 'uk-grid-margin', |
|
2592 | rowfirst : 'uk-row-first' |
|
2593 | }, |
|
2594 | ||
2595 | boot: function() { |
|
2596 | ||
2597 | // init code |
|
2598 | UI.ready(function(context) { |
|
2599 | ||
2600 | UI.$('[data-uk-grid-margin]', context).each(function() { |
|
2601 | var grid = UI.$(this), obj; |
|
2602 | ||
2603 | if (!grid.data('gridMargin')) { |
|
2604 | obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin'))); |
|
2605 | } |
|
2606 | }); |
|
2607 | }); |
|
2608 | }, |
|
2609 | ||
2610 | init: function() { |
|
2611 | ||
2612 | var stackMargin = UI.stackMargin(this.element, this.options); |
|
2613 | } |
|
2614 | }); |
|
2615 | ||
2616 | })(UIkit2); |
|
2617 | ||
2618 | (function(UI) { |
|
2619 |
@@ 2-117 (lines=116) @@ | ||
1 | /*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ |
|
2 | (function(UI) { |
|
3 | ||
4 | "use strict"; |
|
5 | ||
6 | var grids = []; |
|
7 | ||
8 | UI.component('gridMatchHeight', { |
|
9 | ||
10 | defaults: { |
|
11 | target : false, |
|
12 | row : true, |
|
13 | ignorestacked : false, |
|
14 | observe : false |
|
15 | }, |
|
16 | ||
17 | boot: function() { |
|
18 | ||
19 | // init code |
|
20 | UI.ready(function(context) { |
|
21 | ||
22 | UI.$('[data-uk-grid-match]', context).each(function() { |
|
23 | var grid = UI.$(this), obj; |
|
24 | ||
25 | if (!grid.data('gridMatchHeight')) { |
|
26 | obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match'))); |
|
27 | } |
|
28 | }); |
|
29 | }); |
|
30 | }, |
|
31 | ||
32 | init: function() { |
|
33 | ||
34 | var $this = this; |
|
35 | ||
36 | this.columns = this.element.children(); |
|
37 | this.elements = this.options.target ? this.find(this.options.target) : this.columns; |
|
38 | ||
39 | if (!this.columns.length) return; |
|
40 | ||
41 | UI.$win.on('load resize orientationchange', (function() { |
|
42 | ||
43 | var fn = function() { |
|
44 | if ($this.element.is(':visible')) $this.match(); |
|
45 | }; |
|
46 | ||
47 | UI.$(function() { fn(); }); |
|
48 | ||
49 | return UI.Utils.debounce(fn, 50); |
|
50 | })()); |
|
51 | ||
52 | if (this.options.observe) { |
|
53 | ||
54 | UI.domObserve(this.element, function(e) { |
|
55 | if ($this.element.is(':visible')) $this.match(); |
|
56 | }); |
|
57 | } |
|
58 | ||
59 | this.on('display.uk.check', function(e) { |
|
60 | if(this.element.is(':visible')) this.match(); |
|
61 | }.bind(this)); |
|
62 | ||
63 | grids.push(this); |
|
64 | }, |
|
65 | ||
66 | match: function() { |
|
67 | ||
68 | var firstvisible = this.columns.filter(':visible:first'); |
|
69 | ||
70 | if (!firstvisible.length) return; |
|
71 | ||
72 | var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100; |
|
73 | ||
74 | if (stacked && !this.options.ignorestacked) { |
|
75 | this.revert(); |
|
76 | } else { |
|
77 | UI.Utils.matchHeights(this.elements, this.options); |
|
78 | } |
|
79 | ||
80 | return this; |
|
81 | }, |
|
82 | ||
83 | revert: function() { |
|
84 | this.elements.css('min-height', ''); |
|
85 | return this; |
|
86 | } |
|
87 | }); |
|
88 | ||
89 | UI.component('gridMargin', { |
|
90 | ||
91 | defaults: { |
|
92 | cls : 'uk-grid-margin', |
|
93 | rowfirst : 'uk-row-first' |
|
94 | }, |
|
95 | ||
96 | boot: function() { |
|
97 | ||
98 | // init code |
|
99 | UI.ready(function(context) { |
|
100 | ||
101 | UI.$('[data-uk-grid-margin]', context).each(function() { |
|
102 | var grid = UI.$(this), obj; |
|
103 | ||
104 | if (!grid.data('gridMargin')) { |
|
105 | obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin'))); |
|
106 | } |
|
107 | }); |
|
108 | }); |
|
109 | }, |
|
110 | ||
111 | init: function() { |
|
112 | ||
113 | var stackMargin = UI.stackMargin(this.element, this.options); |
|
114 | } |
|
115 | }); |
|
116 | ||
117 | })(UIkit2); |
|
118 |