updated Uikit v2
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||||
(function(addon) {
|
||||
|
||||
var component;
|
||||
|
||||
if (window.UIkit) {
|
||||
component = addon(UIkit);
|
||||
if (window.UIkit2) {
|
||||
component = addon(UIkit2);
|
||||
}
|
||||
|
||||
if (typeof define == "function" && define.amd) {
|
||||
define("uikit-slider", ["uikit"], function(){
|
||||
return component || addon(UIkit);
|
||||
if (typeof define == 'function' && define.amd) {
|
||||
define('uikit-slider', ['uikit'], function(){
|
||||
return component || addon(UIkit2);
|
||||
});
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
this.focus = 0;
|
||||
|
||||
UI.$win.on('resize load', UI.Utils.debounce(function() {
|
||||
$this.resize(true);
|
||||
$this.update(true);
|
||||
}, 100));
|
||||
|
||||
this.on('click.uk.slider', '[data-uk-slider-item]', function(e) {
|
||||
@ -143,11 +143,11 @@
|
||||
mouseleave: function() { $this.hovering = false; }
|
||||
});
|
||||
|
||||
this.resize(true);
|
||||
this.update(true);
|
||||
|
||||
this.on('display.uk.check', function(){
|
||||
if ($this.element.is(":visible")) {
|
||||
$this.resize(true);
|
||||
$this.update(true);
|
||||
}
|
||||
});
|
||||
|
||||
@ -159,9 +159,15 @@
|
||||
this.start();
|
||||
}
|
||||
|
||||
UI.domObserve(this.element, function(e) {
|
||||
if ($this.element.children(':not([data-slider-slide])').length) {
|
||||
$this.update(true);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
resize: function(focus) {
|
||||
update: function(focus) {
|
||||
|
||||
var $this = this, pos = 0, maxheight = 0, item, width, cwidth, size;
|
||||
|
||||
@ -172,7 +178,7 @@
|
||||
|
||||
this.items.each(function(idx){
|
||||
|
||||
item = UI.$(this);
|
||||
item = UI.$(this).attr('data-slider-slide', idx);
|
||||
size = item.css({'left': '', 'width':''})[0].getBoundingClientRect();
|
||||
width = size.width;
|
||||
cwidth = item.width();
|
||||
@ -196,7 +202,7 @@
|
||||
|
||||
this.itemsResized = true;
|
||||
|
||||
return this.resize();
|
||||
return this.update();
|
||||
}
|
||||
|
||||
this.cw = pos;
|
||||
@ -364,9 +370,9 @@
|
||||
var left = item.data('area');
|
||||
|
||||
itm.css({'left': left}).data({
|
||||
'left' : left,
|
||||
'area' : (left+itm.data('width')),
|
||||
'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
|
||||
left : left,
|
||||
area : (left+itm.data('width')),
|
||||
center: (left - ($this.vp/2 - itm.data('cwidth')/2))
|
||||
});
|
||||
|
||||
item = itm;
|
||||
@ -398,9 +404,9 @@
|
||||
var left = item.data('left') - itm.data('width');
|
||||
|
||||
itm.css({'left': left}).data({
|
||||
'left' : left,
|
||||
'area' : (left+itm.data('width')),
|
||||
'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
|
||||
left : left,
|
||||
area : (left+itm.data('width')),
|
||||
center: (left - ($this.vp/2 - itm.data('cwidth')/2))
|
||||
});
|
||||
|
||||
item = itm;
|
||||
@ -513,6 +519,9 @@
|
||||
|
||||
z = z+1 == dragging.items.length ? 0:z+1;
|
||||
}
|
||||
if (!dragging.options.infinite && !focus) {
|
||||
focus = dragging.items.length;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@ -527,6 +536,9 @@
|
||||
|
||||
z = z-1 == -1 ? dragging.items.length-1:z-1;
|
||||
}
|
||||
if (!dragging.options.infinite && !focus) {
|
||||
focus = 0
|
||||
}
|
||||
}
|
||||
|
||||
dragging.updateFocus(focus!==false ? focus:store._focus);
|
||||
|
Reference in New Issue
Block a user