uikit2-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +2 -2
- data/lib/uikit2/rails/version.rb +1 -1
- data/vendor/assets/javascripts/uikit/components/accordion.js +1 -1
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +1 -1
- data/vendor/assets/javascripts/uikit/components/datepicker.js +2 -2
- data/vendor/assets/javascripts/uikit/components/form-password.js +1 -1
- data/vendor/assets/javascripts/uikit/components/form-select.js +1 -1
- data/vendor/assets/javascripts/uikit/components/grid.js +1 -1
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +1 -1
- data/vendor/assets/javascripts/uikit/components/lightbox.js +1 -1
- data/vendor/assets/javascripts/uikit/components/nestable.js +1 -1
- data/vendor/assets/javascripts/uikit/components/notify.js +1 -1
- data/vendor/assets/javascripts/uikit/components/pagination.js +3 -3
- data/vendor/assets/javascripts/uikit/components/parallax.js +9 -5
- data/vendor/assets/javascripts/uikit/components/search.js +1 -1
- data/vendor/assets/javascripts/uikit/components/slider.js +12 -3
- data/vendor/assets/javascripts/uikit/components/slideset.js +1 -1
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +1 -1
- data/vendor/assets/javascripts/uikit/components/slideshow.js +1 -1
- data/vendor/assets/javascripts/uikit/components/sortable.js +1 -1
- data/vendor/assets/javascripts/uikit/components/sticky.js +4 -1
- data/vendor/assets/javascripts/uikit/components/timepicker.js +1 -1
- data/vendor/assets/javascripts/uikit/components/tooltip.js +1 -1
- data/vendor/assets/javascripts/uikit/components/upload.js +1 -1
- data/vendor/assets/javascripts/uikit/core/alert.js +1 -1
- data/vendor/assets/javascripts/uikit/core/button.js +1 -1
- data/vendor/assets/javascripts/uikit/core/core.js +27 -22
- data/vendor/assets/javascripts/uikit/core/cover.js +1 -1
- data/vendor/assets/javascripts/uikit/core/dropdown.js +126 -50
- data/vendor/assets/javascripts/uikit/core/grid.js +1 -1
- data/vendor/assets/javascripts/uikit/core/modal.js +13 -4
- data/vendor/assets/javascripts/uikit/core/nav.js +1 -1
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +1 -1
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +1 -1
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +1 -1
- data/vendor/assets/javascripts/uikit/core/switcher.js +6 -1
- data/vendor/assets/javascripts/uikit/core/tab.js +9 -7
- data/vendor/assets/javascripts/uikit/core/toggle.js +1 -1
- data/vendor/assets/javascripts/uikit/core/touch.js +10 -8
- data/vendor/assets/javascripts/uikit/core/utility.js +51 -1
- data/vendor/assets/javascripts/uikit.js +236 -87
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/accordion.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/autocomplete.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/datepicker.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/dotnav.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-advanced.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-file.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-password.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-select.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/htmleditor.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/nestable.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/notify.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/placeholder.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/progress.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/search.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/search.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slidenav.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slider.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slideshow.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sortable.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sticky.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/tooltip.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/upload.css +1 -1
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +1 -1
- data/vendor/assets/stylesheets/uikit.almost-flat.css +173 -24
- data/vendor/assets/stylesheets/uikit.css +173 -24
- data/vendor/assets/stylesheets/uikit.gradient.css +173 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b8471ce66b662417471d44bf9d5587dbea8a78
|
4
|
+
data.tar.gz: 26a08097d6c9831bbf5389dfafb033c886a0bb4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e4e20340179e007da5b8c0c5117ae3ee565501b60a39b317fc35ad3c4cdd6330686eb536098c43eb9806186e1e7dcace7b42f08cce12670044bb57a8984d85
|
7
|
+
data.tar.gz: 9bedcc384b90667aae6ac61246465b2cdd090f50aa084a12a28c4c9b773e19b5c36ef90964cd4a44c0ae03fd57797b84f3000bcd8c5da1dc4923e7b676ecd8f1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/uikit2-rails.svg)](http://badge.fury.io/rb/uikit2-rails)
|
4
4
|
|
5
|
-
UIkit 2.
|
5
|
+
UIkit 2.23.0
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -46,7 +46,7 @@ In your application.css:
|
|
46
46
|
*/
|
47
47
|
```
|
48
48
|
|
49
|
-
And in
|
49
|
+
And in your application js:
|
50
50
|
|
51
51
|
```js
|
52
52
|
//= require uikit
|
data/lib/uikit2/rails/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
@@ -207,7 +207,7 @@
|
|
207
207
|
var offset = this.element.offset(),
|
208
208
|
css = {"left": offset.left, "right":""};
|
209
209
|
|
210
|
-
this.current = initdate ? moment(initdate, this.options.format):moment();
|
210
|
+
this.current = isNaN(initdate) ? moment(initdate, this.options.format):moment();
|
211
211
|
this.initdate = this.current.format("YYYY-MM-DD");
|
212
212
|
|
213
213
|
this.update();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
/*
|
3
3
|
* Based on simplePagination - Copyright (c) 2012 Flavius Matis - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
|
4
4
|
*/
|
@@ -26,8 +26,8 @@
|
|
26
26
|
items : 1,
|
27
27
|
itemsOnPage : 1,
|
28
28
|
pages : 0,
|
29
|
-
displayedPages :
|
30
|
-
edges :
|
29
|
+
displayedPages : 7,
|
30
|
+
edges : 1,
|
31
31
|
currentPage : 0,
|
32
32
|
lblPrev : false,
|
33
33
|
lblNext : false,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
@@ -25,11 +25,11 @@
|
|
25
25
|
|
26
26
|
scrolltop = UI.$win.scrollTop();
|
27
27
|
|
28
|
-
window.requestAnimationFrame
|
28
|
+
window.requestAnimationFrame(function(){
|
29
29
|
for (var i=0; i < parallaxes.length; i++) {
|
30
30
|
parallaxes[i].process();
|
31
31
|
}
|
32
|
-
}
|
32
|
+
});
|
33
33
|
};
|
34
34
|
|
35
35
|
|
@@ -294,6 +294,10 @@
|
|
294
294
|
h += extra;
|
295
295
|
w += Math.ceil(extra * ratio);
|
296
296
|
|
297
|
+
if (w > size.w && h < size.h) {
|
298
|
+
return obj.element.css({'background-size': ''});
|
299
|
+
}
|
300
|
+
|
297
301
|
// if element height < parent height (gap underneath)
|
298
302
|
if ((w / ratio) < h) {
|
299
303
|
width = Math.ceil(h * ratio);
|
@@ -305,7 +309,7 @@
|
|
305
309
|
height = Math.ceil(w / ratio);
|
306
310
|
}
|
307
311
|
|
308
|
-
|
312
|
+
element.css({'background-size': (width+'px '+height+'px')});
|
309
313
|
};
|
310
314
|
|
311
315
|
img.onerror = function(){
|
@@ -313,7 +317,7 @@
|
|
313
317
|
};
|
314
318
|
|
315
319
|
img.onload = function(){
|
316
|
-
size = {w:img.width,
|
320
|
+
size = {w:img.width, h:img.height};
|
317
321
|
ratio = img.width / img.height;
|
318
322
|
|
319
323
|
UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
@@ -269,13 +269,22 @@
|
|
269
269
|
|
270
270
|
area += this.items.eq(i).data('width');
|
271
271
|
|
272
|
-
if (area
|
272
|
+
if (area == this.vp) {
|
273
273
|
idx = i;
|
274
274
|
break;
|
275
275
|
}
|
276
|
+
|
277
|
+
if (area > this.vp) {
|
278
|
+
idx = (i < this.items.length-1) ? i+1 : i;
|
279
|
+
break;
|
280
|
+
}
|
276
281
|
}
|
277
282
|
|
278
|
-
|
283
|
+
if (area > this.vp) {
|
284
|
+
this.updatePos((this.container.width() - this.vp) * -1);
|
285
|
+
} else {
|
286
|
+
this.updatePos(this.items.eq(idx).data('left')*-1);
|
287
|
+
}
|
279
288
|
}
|
280
289
|
}
|
281
290
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
/*
|
3
3
|
* Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
|
4
4
|
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
@@ -43,6 +43,7 @@
|
|
43
43
|
|
44
44
|
// should be more efficient than using $win.scroll(checkscrollposition):
|
45
45
|
UI.$doc.on('scrolling.uk.document', function(e, data) {
|
46
|
+
if (!data || !data.dir) return;
|
46
47
|
direction = data.dir.y;
|
47
48
|
checkscrollposition();
|
48
49
|
});
|
@@ -141,6 +142,7 @@
|
|
141
142
|
this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
|
142
143
|
this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
|
143
144
|
this.element.addClass(this.options.clsinactive);
|
145
|
+
this.element.trigger('inactive.uk.sticky');
|
144
146
|
|
145
147
|
this.currentTop = null;
|
146
148
|
this.animate = false;
|
@@ -331,6 +333,7 @@
|
|
331
333
|
}
|
332
334
|
|
333
335
|
sticky.element.addClass(sticky.options.clsactive).removeClass(sticky.options.clsinactive);
|
336
|
+
sticky.element.trigger('active.uk.sticky');
|
334
337
|
sticky.element.css('margin', '');
|
335
338
|
|
336
339
|
if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(core) {
|
3
3
|
|
4
4
|
if (typeof define == "function" && define.amd) { // AMD
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
|
46
46
|
|
47
|
-
UI.version = '2.
|
47
|
+
UI.version = '2.23.0';
|
48
48
|
|
49
49
|
UI.noConflict = function() {
|
50
50
|
// restore UIkit version
|
@@ -110,27 +110,30 @@
|
|
110
110
|
})();
|
111
111
|
|
112
112
|
// requestAnimationFrame polyfill
|
113
|
-
//
|
114
|
-
(function(){
|
113
|
+
//https://github.com/darius/requestAnimationFrame
|
114
|
+
(function() {
|
115
115
|
|
116
|
-
|
116
|
+
Date.now = Date.now || function() { return new Date().getTime(); };
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
var
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
var vendors = ['webkit', 'moz'];
|
119
|
+
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
120
|
+
var vp = vendors[i];
|
121
|
+
window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
|
122
|
+
window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
|
123
|
+
|| window[vp+'CancelRequestAnimationFrame']);
|
124
|
+
}
|
125
|
+
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
|
126
|
+
|| !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
127
|
+
var lastTime = 0;
|
128
|
+
window.requestAnimationFrame = function(callback) {
|
129
|
+
var now = Date.now();
|
130
|
+
var nextTime = Math.max(lastTime + 16, now);
|
131
|
+
return setTimeout(function() { callback(lastTime = nextTime); },
|
132
|
+
nextTime - now);
|
130
133
|
};
|
134
|
+
window.cancelAnimationFrame = clearTimeout;
|
131
135
|
}
|
132
|
-
|
133
|
-
})();
|
136
|
+
}());
|
134
137
|
|
135
138
|
UI.support.touch = (
|
136
139
|
('ontouchstart' in document) ||
|
@@ -145,7 +148,7 @@
|
|
145
148
|
UI.Utils = {};
|
146
149
|
|
147
150
|
UI.Utils.isFullscreen = function() {
|
148
|
-
return document.webkitFullscreenElement || document.mozFullScreenElement ||
|
151
|
+
return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || document.fullscreenElement || false;
|
149
152
|
};
|
150
153
|
|
151
154
|
UI.Utils.str2json = function(str, notevil) {
|
@@ -633,7 +636,7 @@
|
|
633
636
|
UI.component.bootComponents();
|
634
637
|
|
635
638
|
// custom scroll observer
|
636
|
-
|
639
|
+
requestAnimationFrame((function(){
|
637
640
|
|
638
641
|
var memory = {x: window.pageXOffset, y:window.pageYOffset}, dir;
|
639
642
|
|
@@ -652,6 +655,8 @@
|
|
652
655
|
|
653
656
|
UI.$doc.trigger('scrolling.uk.document', [memory]);
|
654
657
|
}
|
658
|
+
|
659
|
+
requestAnimationFrame(fn);
|
655
660
|
};
|
656
661
|
|
657
662
|
if (UI.support.touch) {
|
@@ -662,7 +667,7 @@
|
|
662
667
|
|
663
668
|
return fn;
|
664
669
|
|
665
|
-
})()
|
670
|
+
})());
|
666
671
|
|
667
672
|
// run component init functions on dom
|
668
673
|
UI.trigger('domready.uk.dom');
|
@@ -1,18 +1,53 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.23.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(UI) {
|
3
3
|
|
4
4
|
"use strict";
|
5
5
|
|
6
|
-
var active = false, hoverIdle
|
6
|
+
var active = false, hoverIdle, flips = {
|
7
|
+
'x': {
|
8
|
+
"bottom-left" : 'bottom-right',
|
9
|
+
"bottom-right" : 'bottom-left',
|
10
|
+
"bottom-center" : 'bottom-right',
|
11
|
+
"top-left" : 'top-right',
|
12
|
+
"top-right" : 'top-left',
|
13
|
+
"top-center" : 'top-right',
|
14
|
+
"left-top" : 'right',
|
15
|
+
"left-bottom" : 'right-bottom',
|
16
|
+
"left-center" : 'right-center',
|
17
|
+
"right-top" : 'left',
|
18
|
+
"right-bottom" : 'left-bottom',
|
19
|
+
"right-center" : 'left-center'
|
20
|
+
},
|
21
|
+
'y': {
|
22
|
+
"bottom-left" : 'top-left',
|
23
|
+
"bottom-right" : 'top-right',
|
24
|
+
"bottom-center" : 'top-center',
|
25
|
+
"top-left" : 'bottom-left',
|
26
|
+
"top-right" : 'bottom-right',
|
27
|
+
"top-center" : 'bottom-center',
|
28
|
+
"left-top" : 'top-left',
|
29
|
+
"left-bottom" : 'left-bottom',
|
30
|
+
"left-center" : 'top-left',
|
31
|
+
"right-top" : 'top-left',
|
32
|
+
"right-bottom" : 'bottom-left',
|
33
|
+
"right-center" : 'top-left'
|
34
|
+
},
|
35
|
+
'xy': {
|
36
|
+
|
37
|
+
}
|
38
|
+
};
|
7
39
|
|
8
40
|
UI.component('dropdown', {
|
9
41
|
|
10
42
|
defaults: {
|
11
|
-
'mode'
|
12
|
-
'
|
13
|
-
'
|
14
|
-
'
|
15
|
-
'
|
43
|
+
'mode' : 'hover',
|
44
|
+
'pos' : 'bottom-left',
|
45
|
+
'offset' : 0,
|
46
|
+
'remaintime' : 800,
|
47
|
+
'justify' : false,
|
48
|
+
'boundary' : UI.$win,
|
49
|
+
'delay' : 0,
|
50
|
+
'dropdownSelector': '.uk-dropdown,.uk-dropdown-blank',
|
16
51
|
'hoverDelayIdle' : 250
|
17
52
|
},
|
18
53
|
|
@@ -35,7 +70,7 @@
|
|
35
70
|
dropdown.element.trigger(triggerevent);
|
36
71
|
}
|
37
72
|
|
38
|
-
if (dropdown.element.find(
|
73
|
+
if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
|
39
74
|
e.preventDefault();
|
40
75
|
}
|
41
76
|
}
|
@@ -46,18 +81,32 @@
|
|
46
81
|
|
47
82
|
var $this = this;
|
48
83
|
|
49
|
-
this.dropdown
|
84
|
+
this.dropdown = this.find(this.options.dropdownSelector);
|
85
|
+
this.offsetParent = this.dropdown.parents().filter(function() {
|
86
|
+
return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
|
87
|
+
}).slice(0,1);
|
50
88
|
|
51
89
|
this.centered = this.dropdown.hasClass('uk-dropdown-center');
|
52
90
|
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
53
91
|
|
54
92
|
this.boundary = UI.$(this.options.boundary);
|
55
|
-
this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
|
56
93
|
|
57
94
|
if (!this.boundary.length) {
|
58
95
|
this.boundary = UI.$win;
|
59
96
|
}
|
60
97
|
|
98
|
+
// legacy DEPRECATED!
|
99
|
+
if (this.dropdown.hasClass('uk-dropdown-up')) {
|
100
|
+
this.options.pos = 'top-left';
|
101
|
+
}
|
102
|
+
if (this.dropdown.hasClass('uk-dropdown-flip')) {
|
103
|
+
this.options.pos = this.options.pos.replace('left','right');
|
104
|
+
}
|
105
|
+
if (this.dropdown.hasClass('uk-dropdown-center')) {
|
106
|
+
this.options.pos = this.options.pos.replace(/(left|right)/,'center');
|
107
|
+
}
|
108
|
+
//-- end legacy
|
109
|
+
|
61
110
|
// Init ARIA
|
62
111
|
this.element.attr('aria-haspopup', 'true');
|
63
112
|
this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
|
@@ -68,7 +117,7 @@
|
|
68
117
|
|
69
118
|
var $target = UI.$(e.target);
|
70
119
|
|
71
|
-
if (!$target.parents(
|
120
|
+
if (!$target.parents($this.options.dropdownSelector).length) {
|
72
121
|
|
73
122
|
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
|
74
123
|
e.preventDefault();
|
@@ -228,66 +277,93 @@
|
|
228
277
|
|
229
278
|
if (!this.dropdown.length) return;
|
230
279
|
|
280
|
+
// reset
|
281
|
+
this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
|
282
|
+
'top-left':'',
|
283
|
+
'left':'',
|
284
|
+
'margin-left' :'',
|
285
|
+
'margin-right':''
|
286
|
+
});
|
287
|
+
|
231
288
|
if (this.justified && this.justified.length) {
|
232
289
|
this.dropdown.css("min-width", "");
|
233
290
|
}
|
234
291
|
|
235
|
-
var $this
|
236
|
-
|
237
|
-
|
238
|
-
|
292
|
+
var $this = this,
|
293
|
+
pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
|
294
|
+
posoffset = this.options.offset,
|
295
|
+
dropdown = this.dropdown,
|
296
|
+
offset = dropdown.show().offset(),
|
297
|
+
width = dropdown.outerWidth(),
|
298
|
+
height = dropdown.outerHeight(),
|
239
299
|
boundarywidth = this.boundary.width(),
|
240
|
-
boundaryoffset = this.boundary.offset() ? this.boundary.offset()
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
300
|
+
boundaryoffset = this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
|
301
|
+
dpos = this.options.pos;
|
302
|
+
|
303
|
+
var variants = {
|
304
|
+
"bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
|
305
|
+
"bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
|
306
|
+
"bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
|
307
|
+
"top-left" : {top: 0 - height - posoffset, left: 0},
|
308
|
+
"top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
|
309
|
+
"top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
|
310
|
+
"left-top" : {top: 0, left: 0 - width - posoffset},
|
311
|
+
"left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
|
312
|
+
"left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
|
313
|
+
"right-top" : {top: 0, left: 0 + pos.width + posoffset},
|
314
|
+
"right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
|
315
|
+
"right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
|
316
|
+
},
|
317
|
+
css = {},
|
318
|
+
pp;
|
246
319
|
|
247
|
-
|
248
|
-
|
249
|
-
dropdown.css("margin-" + UI.langdirection, "");
|
250
|
-
offset = dropdown.offset();
|
251
|
-
}
|
252
|
-
}
|
320
|
+
pp = dpos.split('-');
|
321
|
+
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
253
322
|
|
254
323
|
// justify dropdown
|
255
324
|
if (this.justified && this.justified.length) {
|
256
|
-
justify(dropdown, this.justified, boundarywidth
|
257
|
-
|
258
|
-
}
|
325
|
+
justify(dropdown.css({left:0}), this.justified, boundarywidth);
|
326
|
+
} else {
|
259
327
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
328
|
+
switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
|
329
|
+
|
330
|
+
case "x":
|
331
|
+
dpos = flips['x'][dpos] || 'right-top';
|
332
|
+
break;
|
333
|
+
case "y":
|
334
|
+
dpos = flips['y'][dpos] || 'top-left';
|
335
|
+
break;
|
336
|
+
case "xy":
|
337
|
+
dpos = flips['xy'][dpos] || 'right-bottom';
|
338
|
+
break;
|
339
|
+
}
|
264
340
|
|
265
|
-
|
341
|
+
pp = dpos.split('-');
|
342
|
+
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
343
|
+
}
|
266
344
|
|
345
|
+
if (width > boundarywidth) {
|
267
346
|
dropdown.addClass("uk-dropdown-stack");
|
347
|
+
this.trigger('stack.uk.dropdown', [this]);
|
348
|
+
}
|
268
349
|
|
269
|
-
|
350
|
+
dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
|
351
|
+
},
|
270
352
|
|
271
|
-
|
272
|
-
dropdown.removeClass('uk-dropdown-flip');
|
273
|
-
offset = dropdown.offset();
|
274
|
-
dropdown.addClass('uk-dropdown-flip');
|
275
|
-
}
|
353
|
+
checkBoundary: function(left, top, width, height, boundarywidth) {
|
276
354
|
|
277
|
-
|
355
|
+
var axis = "";
|
278
356
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
}, 0);
|
283
|
-
}
|
357
|
+
if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
|
358
|
+
axis += "x";
|
359
|
+
}
|
284
360
|
|
285
|
-
|
361
|
+
if (top < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
|
362
|
+
axis += "y";
|
286
363
|
}
|
287
364
|
|
288
|
-
|
365
|
+
return axis;
|
289
366
|
}
|
290
|
-
|
291
367
|
});
|
292
368
|
|
293
369
|
|