uikit 3.11.2-dev.f2970ffaa → 3.11.2-dev.fb043abc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +1 -1
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +1 -1
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +6 -17
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +1 -1
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +68 -34
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +73 -50
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/parallax.js +5 -16
  44. package/src/js/core/sticky.js +38 -19
  45. package/src/js/util/dimensions.js +28 -12
  46. package/tests/sticky-parallax.html +43 -40
  47. package/tests/sticky.html +45 -24
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit",
3
3
  "title": "UIkit",
4
4
  "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
- "version": "3.11.2-dev.f2970ffaa",
5
+ "version": "3.11.2-dev.fb043abc2",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -28,13 +28,15 @@ export default {
28
28
  },
29
29
 
30
30
  start({start}) {
31
- return parseCalc(start, this.target);
31
+ return toPx(start, 'height', this.target, true);
32
32
  },
33
33
 
34
34
  end({end, viewport}) {
35
- return parseCalc(
35
+ return toPx(
36
36
  end || (viewport = (1 - viewport) * 100) && `${viewport}vh+${viewport}%`,
37
- this.target
37
+ 'height',
38
+ this.target,
39
+ true
38
40
  );
39
41
  }
40
42
 
@@ -77,19 +79,6 @@ export default {
77
79
 
78
80
  };
79
81
 
80
- const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
81
- function parseCalc(calc, el) {
82
- let match;
83
- let result = 0;
84
- calc = calc.toString().replace(/\s/g, '');
85
- calcRe.lastIndex = 0;
86
- while ((match = calcRe.exec(calc)) !== null) {
87
- result += toPx(match[0], 'height', el, true);
88
- }
89
-
90
- return result;
91
- }
92
-
93
82
  function ease(percent, easing) {
94
83
  return easing >= 0
95
84
  ? Math.pow(percent, easing + 1)
@@ -1,12 +1,13 @@
1
1
  import Class from '../mixin/class';
2
2
  import Media from '../mixin/media';
3
- import {$, addClass, after, Animation, assign, clamp, css, dimensions, fastdom, height as getHeight, getScrollingElement, hasClass, isNumeric, isString, isVisible, noop, offset, offsetPosition, parent, query, remove, removeClass, replaceClass, scrollTop, toFloat, toggleClass, toPx, trigger, within} from 'uikit-util';
3
+ import {$, addClass, after, Animation, clamp, css, dimensions, fastdom, height as getHeight, getScrollingElement, hasClass, isNumeric, isString, isVisible, noop, offset, offsetPosition, parent, query, remove, removeClass, replaceClass, scrollTop, toggleClass, toPx, trigger, within} from 'uikit-util';
4
4
 
5
5
  export default {
6
6
 
7
7
  mixins: [Class, Media],
8
8
 
9
9
  props: {
10
+ position: String,
10
11
  top: null,
11
12
  bottom: Boolean,
12
13
  offset: String,
@@ -22,6 +23,7 @@ export default {
22
23
  },
23
24
 
24
25
  data: {
26
+ position: 'top',
25
27
  top: 0,
26
28
  bottom: false,
27
29
  offset: 0,
@@ -38,8 +40,19 @@ export default {
38
40
 
39
41
  computed: {
40
42
 
41
- offset({offset}) {
42
- return toPx(offset);
43
+ position({position}, $el) {
44
+ return position === 'auto'
45
+ ? (this.isFixed ? this.placeholder : $el).offsetHeight > getHeight(window)
46
+ ? 'bottom'
47
+ : 'top'
48
+ : position;
49
+ },
50
+
51
+ offset({offset}, $el) {
52
+ if (this.position === 'bottom') {
53
+ offset += '+100vh-100%';
54
+ }
55
+ return toPx(offset, 'height', $el);
43
56
  },
44
57
 
45
58
  selTarget({selTarget}, $el) {
@@ -130,7 +143,7 @@ export default {
130
143
 
131
144
  {
132
145
 
133
- read({height}, types) {
146
+ read({height, margin}, types) {
134
147
 
135
148
  this.inactive = !this.matchMedia || !isVisible(this.$el);
136
149
 
@@ -138,13 +151,19 @@ export default {
138
151
  return false;
139
152
  }
140
153
 
141
- if (this.isActive && types.has('resize')) {
154
+ const hide = this.isActive && types.has('resize');
155
+ if (hide) {
142
156
  this.hide();
157
+ }
158
+
159
+ if (!this.isActive) {
143
160
  height = this.$el.offsetHeight;
144
- this.show();
161
+ margin = css(this.$el, 'margin');
145
162
  }
146
163
 
147
- height = this.isActive ? height : this.$el.offsetHeight;
164
+ if (hide) {
165
+ this.show();
166
+ }
148
167
 
149
168
  const overflow = Math.max(0, height + this.offset - getHeight(window));
150
169
 
@@ -152,8 +171,10 @@ export default {
152
171
  const topOffset = offset(referenceElement).top;
153
172
  const offsetParentTop = offset(referenceElement.offsetParent).top;
154
173
 
155
- const bottom = parseProp('bottom', this);
156
- const start = Math.max(toFloat(parseProp('top', this)), topOffset) - this.offset;
174
+ const top = parseProp(this.top, this.$el, topOffset);
175
+ const bottom = parseProp(this.bottom, this.$el, topOffset + height);
176
+
177
+ const start = Math.max(top, topOffset) - this.offset;
157
178
  const end = bottom
158
179
  ? bottom - this.$el.offsetHeight + overflow - this.offset
159
180
  : getScrollingElement(this.$el).scrollHeight - getHeight(window);
@@ -165,17 +186,17 @@ export default {
165
186
  topOffset,
166
187
  offsetParentTop,
167
188
  height,
189
+ margin,
168
190
  width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).width,
169
- top: offsetPosition(this.placeholder)[0],
170
- margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
191
+ top: offsetPosition(this.placeholder)[0]
171
192
  };
172
193
  },
173
194
 
174
- write({height, margins}) {
195
+ write({height, margin}) {
175
196
 
176
197
  const {placeholder} = this;
177
198
 
178
- css(placeholder, assign({height}, margins));
199
+ css(placeholder, {height, margin});
179
200
 
180
201
  if (!within(placeholder, document)) {
181
202
  after(this.$el, placeholder);
@@ -300,7 +321,7 @@ export default {
300
321
 
301
322
  const {width, scroll = 0, overflow, overflowScroll = 0, start, end, topOffset, height, offsetParentTop} = this._data;
302
323
  const active = start !== 0 || scroll > start;
303
- let top = Math.max(0, this.offset);
324
+ let top = this.offset;
304
325
  let position = 'fixed';
305
326
 
306
327
  if (scroll > end) {
@@ -328,12 +349,10 @@ export default {
328
349
 
329
350
  };
330
351
 
331
- function parseProp(prop, {$props, $el, [`${prop}Offset`]: propOffset}) {
332
-
333
- const value = $props[prop];
352
+ function parseProp(value, el, propOffset) {
334
353
 
335
354
  if (!value) {
336
- return;
355
+ return 0;
337
356
  }
338
357
 
339
358
  if (isString(value) && value.match(/^-?\d/)) {
@@ -342,7 +361,7 @@ function parseProp(prop, {$props, $el, [`${prop}Offset`]: propOffset}) {
342
361
 
343
362
  } else {
344
363
 
345
- return offset(value === true ? parent($el) : query(value, $el)).bottom;
364
+ return offset(value === true ? parent(el) : query(value, el)).bottom;
346
365
 
347
366
  }
348
367
  }
@@ -1,5 +1,5 @@
1
1
  import {css} from './style';
2
- import {each, endsWith, isDocument, isElement, isNumeric, isUndefined, isWindow, toFloat, toNode, toWindow, ucfirst} from './lang';
2
+ import {each, isDocument, isElement, isString, isUndefined, isWindow, memoize, toFloat, toNode, toWindow, ucfirst} from './lang';
3
3
 
4
4
  const dirs = {
5
5
  width: ['left', 'right'],
@@ -157,19 +157,35 @@ export function flipPosition(pos) {
157
157
  }
158
158
 
159
159
  export function toPx(value, property = 'width', element = window, offsetDim = false) {
160
- return isNumeric(value)
161
- ? +value
162
- : endsWith(value, 'vh')
163
- ? percent(height(toWindow(element)), value)
164
- : endsWith(value, 'vw')
165
- ? percent(width(toWindow(element)), value)
166
- : endsWith(value, '%')
167
- ? percent(offsetDim
168
- ? element[`offset${ucfirst(property)}`]
169
- : dimensions(element)[property], value)
170
- : toFloat(value);
160
+
161
+ if (!isString(value)) {
162
+ return toFloat(value);
163
+ }
164
+
165
+ return parseCalc(value).reduce((result, value) => {
166
+ const unit = parseUnit(value);
167
+ if (unit) {
168
+ value = percent(
169
+ unit === 'vh'
170
+ ? height(toWindow(element))
171
+ : unit === 'vw'
172
+ ? width(toWindow(element))
173
+ : offsetDim
174
+ ? element[`offset${ucfirst(property)}`]
175
+ : dimensions(element)[property],
176
+ value
177
+ );
178
+ }
179
+
180
+ return result + toFloat(value);
181
+ }, 0);
171
182
  }
172
183
 
184
+ const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
185
+ const parseCalc = memoize(calc => calc.toString().replace(/\s/g, '').match(calcRe) || []);
186
+ const unitRe = /(?:v[hw]|%)$/;
187
+ const parseUnit = memoize(str => (str.match(unitRe) || [])[0]);
188
+
173
189
  function percent(base, value) {
174
190
  return base * toFloat(value) / 100;
175
191
  }
@@ -8,7 +8,7 @@
8
8
  <script src="js/test.js"></script>
9
9
  </head>
10
10
 
11
- <body style="padding-bottom: 1100px;">
11
+ <body style="padding-bottom: 100vh;">
12
12
 
13
13
  <div class="uk-section uk-section-primary uk-position-z-index-negative uk-flex uk-flex-center uk-flex-middle uk-text-center" uk-sticky="bottom: +* +*" uk-height-viewport>
14
14
  <div class="uk-container">
@@ -21,21 +21,20 @@
21
21
  <div class="uk-section uk-section-default">
22
22
  <div class="uk-container">
23
23
 
24
- <div id="js-sticky-parallax-container" class="uk-position-relative uk-background-muted uk-text-center" style="height: 200vh">
25
- <div uk-sticky="bottom: #js-sticky-parallax-container; offset: 20vh">
24
+ <div id="js-sticky-parallax-container" class="uk-position-relative uk-background-muted uk-text-center" style="height: 300vh">
25
+ <div class="uk-flex uk-flex-center uk-flex-middle" style="height: 100vh;" uk-sticky="bottom: #js-sticky-parallax-container">
26
+ <div>
26
27
 
27
- <div class="uk-position-center">
28
- <div class="uk-flex">
29
- <div>
30
- <h1 class="uk-heading-2xlarge" uk-parallax="target: #js-sticky-parallax-container; x: 0,-250,-250,0; easing: -1; start: 60vh; end: 100vh;">Sticky</h1>
31
- </div>
32
- <div>
33
- <h1 class="uk-heading-2xlarge" uk-parallax="target: #js-sticky-parallax-container; x: 0,250,250,0; easing: -1; start: 60vh; end: 100vh;">Parallax</h1>
34
- </div>
28
+ <img class="uk-position-relative uk-position-z-index" src="images/size-v.jpg" alt="" width="400" height="800" style="max-width: 50vw" uk-parallax="target: #js-sticky-parallax-container; y: 0,-250; easing: -1; start: 100vh; end: 100vh;">
29
+
30
+ <div style="margin-top: -200px">
31
+ <h1 class="uk-heading-2xlarge">
32
+ <span class="uk-display-inline-block" uk-parallax="target: #js-sticky-parallax-container; x: 0,-15vw,-7vw,0; easing: -1; start: 60vh; end: 100vh;">Sticky</span>
33
+ <br><span class="uk-display-inline-block" uk-parallax="target: #js-sticky-parallax-container; x: 0,10vw,5vw,0; easing: -1; start: 60vh; end: 100vh;">Parallax</span>
34
+ </h1>
35
35
  </div>
36
- </div>
37
36
 
38
- <img class="uk-position-relative uk-position-z-index" src="images/size-v.jpg" alt="" width="400" height="800">
37
+ </div>
39
38
 
40
39
  </div>
41
40
  </div>
@@ -117,7 +116,7 @@
117
116
 
118
117
  <div class="uk-section uk-section-default">
119
118
 
120
- <div id="js-sticky-parallax-viewport" class="uk-child-width-1-3 uk-text-center" uk-grid>
119
+ <div id="js-sticky-parallax-viewport" class="uk-child-width-1-2 uk-child-width-1-3@s uk-text-center" uk-grid>
121
120
  <div>
122
121
 
123
122
  <img class="uk-margin-large" src="images/photo.jpg" alt="" width="1800" height="1200">
@@ -125,13 +124,15 @@
125
124
  <img class="uk-margin-large" src="images/photo2.jpg" alt="" width="1800" height="1200">
126
125
  <img class="uk-margin-large" src="images/photo.jpg" alt="" width="1800" height="1200">
127
126
  <img class="uk-margin-large" src="images/photo3.jpg" alt="" width="1800" height="1200">
127
+ <img class="uk-margin-large" src="images/photo2.jpg" alt="" width="1800" height="1200">
128
+ <img class="uk-margin-large" src="images/photo.jpg" alt="" width="1800" height="1200">
128
129
 
129
130
  </div>
130
131
  <div>
131
132
 
132
- <div class="uk-tile uk-tile-muted uk-text-center" style="height: 100vh" uk-sticky="bottom: #js-sticky-parallax-viewport">
133
+ <div class="uk-background-muted uk-text-center" style="height: 100vh" uk-sticky="bottom: #js-sticky-parallax-viewport">
133
134
 
134
- <div uk-parallax="target: #js-sticky-parallax-viewport; start: 100vh; end: 100vh; y: 0, 35vh; easing: 0">
135
+ <div uk-parallax="target: #js-sticky-parallax-viewport; start: 100vh; end: 100vh; y: 10vh, 80vh; easing: 0">
135
136
 
136
137
  <h1 class="uk-margin-remove">Sticky Parallax Viewport</h1>
137
138
 
@@ -140,13 +141,15 @@
140
141
  </div>
141
142
 
142
143
  </div>
143
- <div>
144
+ <div class="uk-visible@s">
144
145
 
145
146
  <img class="uk-margin-large" src="images/photo2.jpg" alt="" width="1800" height="1200">
146
147
  <img class="uk-margin-large" src="images/photo.jpg" alt="" width="1800" height="1200">
147
148
  <img class="uk-margin-large" src="images/photo3.jpg" alt="" width="1800" height="1200">
148
149
  <img class="uk-margin-large" src="images/photo2.jpg" alt="" width="1800" height="1200">
149
150
  <img class="uk-margin-large" src="images/photo.jpg" alt="" width="1800" height="1200">
151
+ <img class="uk-margin-large" src="images/photo3.jpg" alt="" width="1800" height="1200">
152
+ <img class="uk-margin-large" src="images/photo2.jpg" alt="" width="1800" height="1200">
150
153
 
151
154
  </div>
152
155
  </div>
@@ -155,10 +158,10 @@
155
158
 
156
159
  <div class="uk-section uk-section-default">
157
160
 
158
- <div id="js-sticky-parallax-images" class="uk-child-width-1-3" style="height: 250vh" uk-grid>
159
- <div class="uk-background-muted uk-width-expand">
161
+ <div id="js-sticky-parallax-images" style="height: 250vh" uk-grid>
162
+ <div class="uk-width-expand">
160
163
 
161
- <div style="height: 100vh;" uk-sticky="bottom: #js-sticky-parallax-images">
164
+ <div class="uk-background-muted" style="height: 100vh;" uk-sticky="bottom: #js-sticky-parallax-images">
162
165
  <div uk-parallax="target: #js-sticky-parallax-images; y: 55vh, 45vh;">
163
166
  <img class="uk-position-center-left" src="images/photo.jpg" alt="" width="1800" height="1200">
164
167
  <img class="uk-position-center-left" src="images/photo2.jpg" alt="" width="1800" height="1200" uk-parallax="target: #js-sticky-parallax-images; start: 125vh; end: 100% + 100vh - 135vh; opacity: 0,1">
@@ -167,12 +170,12 @@
167
170
  </div>
168
171
 
169
172
  </div>
170
- <div class="uk-width-small">
171
- <div class="uk-position-relative uk-background-muted" style="height: 75vh"><div class="uk-position-bottom-center">75vh</div></div>
172
- <div class="uk-position-relative uk-background-primary uk-light" style="height: 50vh"><div class="uk-position-bottom-center">125vh</div></div>
173
- <div class="uk-position-relative uk-background-secondary uk-light" style="height: 50vh"><div class="uk-position-bottom-center">175vh</div></div>
174
- <div class="uk-position-relative uk-background-muted" style="height: 50vh"><div class="uk-position-bottom-center">225vh</div></div>
175
- <div class="uk-position-relative uk-background-primary uk-light" style="height: 25vh"><div class="uk-position-bottom-center">250vh</div></div>
173
+ <div class="uk-width-auto uk-text-small">
174
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-muted" style="height: 75vh">75vh</div>
175
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-primary uk-light" style="height: 50vh">125vh</div>
176
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-secondary uk-light" style="height: 50vh">175vh</div>
177
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-muted" style="height: 50vh">225vh</div>
178
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-primary uk-light" style="height: 25vh">250vh</div>
176
179
  </div>
177
180
  <div class="uk-width-expand">
178
181
 
@@ -183,7 +186,7 @@
183
186
 
184
187
  <h1>Sticky Parallax Images 1</h1>
185
188
 
186
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
189
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
187
190
 
188
191
  </div>
189
192
  </div>
@@ -193,7 +196,7 @@
193
196
 
194
197
  <h1>Sticky Parallax Images 2</h1>
195
198
 
196
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
199
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
197
200
 
198
201
  </div>
199
202
  </div>
@@ -203,7 +206,7 @@
203
206
 
204
207
  <h1>Sticky Parallax Images 3</h1>
205
208
 
206
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
209
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
207
210
 
208
211
  </div>
209
212
  </div>
@@ -215,10 +218,10 @@
215
218
 
216
219
  <div class="uk-section uk-section-default">
217
220
 
218
- <div id="js-sticky-parallax-images-all" class="uk-child-width-1-3" style="height: 250vh" uk-grid>
219
- <div class="uk-background-muted uk-width-expand">
221
+ <div id="js-sticky-parallax-images-all" style="height: 250vh" uk-grid>
222
+ <div class="uk-width-expand">
220
223
 
221
- <div style="height: 100vh;" uk-sticky="bottom: #js-sticky-parallax-images-all">
224
+ <div class="uk-background-muted" style="height: 100vh;" uk-sticky="bottom: #js-sticky-parallax-images-all">
222
225
  <div uk-parallax="target: #js-sticky-parallax-images-all; y: 55vh, 45vh;">
223
226
  <img class="uk-position-center-left" src="images/photo.jpg" alt="" width="1800" height="1200">
224
227
  <img class="uk-position-center-left" src="images/photo2.jpg" alt="" width="1800" height="1200" uk-parallax="target: #js-sticky-parallax-images-all; start: 150vh; end: 100% + 100vh - 160vh; opacity: 0,1">
@@ -227,11 +230,11 @@
227
230
  </div>
228
231
 
229
232
  </div>
230
- <div class="uk-width-small">
231
- <div class="uk-position-relative uk-background-muted" style="height: 100vh"><div class="uk-position-bottom-center">100vh</div></div>
232
- <div class="uk-position-relative uk-background-primary uk-light" style="height: 50vh"><div class="uk-position-bottom-center">150vh</div></div>
233
- <div class="uk-position-relative uk-background-secondary uk-light" style="height: 50vh"><div class="uk-position-bottom-center">200vh</div></div>
234
- <div class="uk-position-relative uk-background-muted" style="height: 50vh"><div class="uk-position-bottom-center">250vh</div></div>
233
+ <div class="uk-width-auto uk-text-small">
234
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-muted" style="height: 100vh">100vh</div>
235
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-primary uk-light" style="height: 50vh">150vh</div>
236
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-secondary uk-light" style="height: 50vh">200vh</div>
237
+ <div class="uk-flex uk-flex-center uk-flex-bottom uk-background-muted" style="height: 50vh">250vh</div>
235
238
  </div>
236
239
  <div class="uk-width-expand">
237
240
 
@@ -242,7 +245,7 @@
242
245
 
243
246
  <h1>Sticky Parallax Images All 1</h1>
244
247
 
245
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
248
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
246
249
 
247
250
  </div>
248
251
  </div>
@@ -251,7 +254,7 @@
251
254
 
252
255
  <h1>Sticky Parallax Images All 2</h1>
253
256
 
254
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
257
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
255
258
 
256
259
  </div>
257
260
  </div>
@@ -259,7 +262,7 @@
259
262
 
260
263
  <h1>Sticky Parallax Images All 3</h1>
261
264
 
262
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
265
+ <p class="uk-visible@s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
263
266
 
264
267
  </div>
265
268
  </div>
package/tests/sticky.html CHANGED
@@ -8,54 +8,69 @@
8
8
  <script src="js/test.js"></script>
9
9
  <style>
10
10
 
11
- #viewport { border: 1px dashed rgba(0,0,0,0.2); }
11
+ .viewport { border: 1px dashed rgba(0,0,0,0.2); }
12
12
 
13
13
  </style>
14
14
  </head>
15
15
 
16
16
  <body>
17
17
 
18
- <div class="uk-container" style="height: 3500px;">
18
+ <div class="uk-container">
19
19
 
20
20
  <h1>Sticky</h1>
21
21
 
22
- <div id="viewport" class="uk-margin">
23
- <div class="uk-grid uk-child-width-1-6" uk-height-viewport="offset-top: true">
24
- <div>
22
+ <div class="uk-grid">
23
+ <div class="uk-width-5-6">
24
+ <div class="viewport uk-margin">
25
+ <div class="uk-grid uk-child-width-1-6" uk-height-viewport="offset-top: true">
26
+ <div>
25
27
 
26
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="offset: 50; bottom: #viewport">Stick to container; 50px offset</div>
28
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="offset: 50; bottom: !.viewport">Stick to container; 50px offset</div>
27
29
 
28
- </div>
29
- <div>
30
+ </div>
31
+ <div>
30
32
 
31
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: 50vh; target-offset: 10">Sticky after 50vh; Scroll up if initially above paragraph below</div>
33
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: 50vh; target-offset: 10">Sticky after 50vh; Scroll up if initially above paragraph below</div>
32
34
 
33
- </div>
34
- <div>
35
+ </div>
36
+ <div>
35
37
 
36
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: #viewport; animation: uk-animation-slide-top">Stick below container; animation</div>
38
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: !.viewport; animation: uk-animation-slide-top">Stick below container; animation</div>
37
39
 
38
- </div>
39
- <div>
40
+ </div>
41
+ <div>
40
42
 
41
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="bottom: #hash">Stick until next paragraph</div>
43
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="bottom: #hash">Stick until next paragraph</div>
42
44
 
43
- </div>
44
- <div>
45
+ </div>
46
+ <div>
45
47
 
46
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="show-on-up: true; animation: uk-animation-slide-top">Sticky on scroll up; animation</div>
48
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="show-on-up: true; animation: uk-animation-slide-top">Sticky on scroll up; animation</div>
47
49
 
48
- </div>
49
- <div>
50
+ </div>
51
+ <div>
50
52
 
51
- <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: 300; animation: uk-animation-slide-top; media: 640">Sticky after 300px scrolling; @media 640px</div>
53
+ <div class="uk-card uk-card-primary uk-card-body" uk-sticky="top: 300; animation: uk-animation-slide-top; media: 640">Sticky after 300px scrolling; @media 640px</div>
52
54
 
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <p id="hash" class="uk-margin-large">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
60
+ </div>
61
+ <div class="uk-width-1-6">
62
+ <div class="viewport" style="min-height: 200vh;">
63
+ <div>
64
+ <div class="uk-card uk-card-primary uk-card-body" style="height: 120vh" uk-sticky="bottom: !.viewport">
65
+ <p>Oversized Content</p>
66
+
67
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
68
+ </div>
69
+ </div>
53
70
  </div>
54
71
  </div>
55
72
  </div>
56
73
 
57
- <p id="hash" class="uk-margin-large">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
58
-
59
74
  <h2>JavaScript Options</h2>
60
75
 
61
76
  <div class="uk-overflow-auto">
@@ -69,11 +84,17 @@
69
84
  </tr>
70
85
  </thead>
71
86
  <tbody>
87
+ <tr>
88
+ <td><code>position</code></td>
89
+ <td>`top`|`bottom`|`auto`</td>
90
+ <td>`top`</td>
91
+ <td>The position the element should be stuck to. With position `auto` the element sticks to the top of the viewport if it's smaller than the viewport, otherwise it sticks to the top.</td>
92
+ </tr>
72
93
  <tr>
73
94
  <td><code>top</code></td>
74
95
  <td>Number|Viewport Height|CSS Selector</td>
75
96
  <td>0</td>
76
- <td>The top offset from where the element should be stick.</td>
97
+ <td>The top offset from where the element should stick.</td>
77
98
  </tr>
78
99
  <tr>
79
100
  <td><code>bottom</code></td>