vendor/assets/javascripts/uikit/components/slideset.js in uikit2-rails-0.1.9 vs vendor/assets/javascripts/uikit/components/slideset.js in uikit2-rails-0.1.10
- old
+ new
@@ -1,16 +1,16 @@
-/*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
var component;
if (window.UIkit) {
component = addon(UIkit);
}
- if (typeof define == "function" && define.amd) {
- define("uikit-slideset", ["uikit"], function(){
+ if (typeof define == 'function' && define.amd) {
+ define('uikit-slideset', ['uikit'], function(){
return component || addon(UIkit);
});
}
})(function(UI){
@@ -38,16 +38,16 @@
boot: function() {
// auto init
UI.ready(function(context) {
- UI.$("[data-uk-slideset]", context).each(function(){
+ UI.$('[data-uk-slideset]', context).each(function(){
var ele = UI.$(this);
- if(!ele.data("slideset")) {
- UI.slideset(ele, UI.Utils.options(ele.attr("data-uk-slideset")));
+ if(!ele.data('slideset')) {
+ UI.slideset(ele, UI.Utils.options(ele.attr('data-uk-slideset')));
}
});
});
},
@@ -58,12 +58,12 @@
this.activeSet = false;
this.list = this.element.find('.uk-slideset');
this.nav = this.element.find('.uk-slideset-nav');
this.controls = this.options.controls ? UI.$(this.options.controls) : this.element;
- UI.$win.on("resize load", UI.Utils.debounce(function() {
- $this.updateSets();
+ UI.$win.on('resize load', UI.Utils.debounce(function() {
+ $this.update();
}, 100));
$this.list.addClass('uk-grid-width-1-'+$this.options.default);
['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
@@ -73,11 +73,11 @@
}
$this.list.addClass('uk-grid-width-'+bp+'-1-'+$this.options[bp]);
});
- this.on("click.uk.slideset", '[data-uk-slideset-item]', function(e) {
+ this.on('click.uk.slideset', '[data-uk-slideset-item]', function(e) {
e.preventDefault();
if ($this.animating) {
return;
@@ -114,33 +114,39 @@
$this.updateFilter(ele.attr('data-uk-filter'));
$this._hide().then(function(){
- $this.updateSets(true, true);
+ $this.update(true, true);
});
});
this.on('swipeRight swipeLeft', function(e) {
$this[e.type=='swipeLeft' ? 'next' : 'previous']();
});
this.updateFilter(this.options.filter);
- this.updateSets();
+ this.update();
this.element.on({
mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
mouseleave: function() { $this.hovering = false; }
});
// Set autoplay
if (this.options.autoplay) {
this.start();
}
+
+ UI.domObserve(this.list, function(e) {
+ if ($this.list.children(':visible:not(.uk-active)').length) {
+ $this.update(false,true);
+ }
+ });
},
- updateSets: function(animate, force) {
+ update: function(animate, force) {
var visible = this.visible, i;
this.visible = this.getVisibleOnCurrenBreakpoint();
@@ -415,10 +421,12 @@
} else {
clsIn = cls;
clsOut = clsIn;
}
+ UI.$body.css('overflow-x', 'hidden'); // prevent horizontal scrollbar on animation
+
release = function() {
if (current && current.length) {
current.hide().removeClass(clsOut+' uk-animation-reverse').css({'opacity':'', 'animation-delay': '', 'animation':''});
}
@@ -433,9 +441,10 @@
}
var finish = function() {
next.removeClass(''+clsIn+'').css({opacity:'', display:'', 'animation-delay':'', 'animation':''});
d.resolve();
+ UI.$body.css('overflow-x', '');
$this.element.css('min-height', '');
finish = false;
};
next.addClass(clsIn)[dir==1 ? 'last':'first']().one(UI.support.animation.end, function(){