rails-uikit-sass 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
- data/lib/rails-uikit-sass.rb +12 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/components/accordion.js +180 -0
- data/vendor/assets/javascripts/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/components/form-password.js +67 -0
- data/vendor/assets/javascripts/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/components/form-select.js +85 -0
- data/vendor/assets/javascripts/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/grid.js +540 -0
- data/vendor/assets/javascripts/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/components/lightbox.js +588 -0
- data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/components/nestable.js +653 -0
- data/vendor/assets/javascripts/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/components/notify.js +189 -0
- data/vendor/assets/javascripts/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/components/pagination.js +147 -0
- data/vendor/assets/javascripts/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/components/parallax.js +462 -0
- data/vendor/assets/javascripts/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/search.js +92 -0
- data/vendor/assets/javascripts/components/search.min.js +2 -0
- data/vendor/assets/javascripts/components/slider.js +552 -0
- data/vendor/assets/javascripts/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/components/slideset.js +523 -0
- data/vendor/assets/javascripts/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
- data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/components/sortable.js +688 -0
- data/vendor/assets/javascripts/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/components/sticky.js +364 -0
- data/vendor/assets/javascripts/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/components/tooltip.js +235 -0
- data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/components/upload.js +262 -0
- data/vendor/assets/javascripts/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/core/alert.js +66 -0
- data/vendor/assets/javascripts/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/core/button.js +156 -0
- data/vendor/assets/javascripts/core/button.min.js +2 -0
- data/vendor/assets/javascripts/core/core.js +820 -0
- data/vendor/assets/javascripts/core/core.min.js +2 -0
- data/vendor/assets/javascripts/core/cover.js +87 -0
- data/vendor/assets/javascripts/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/core/dropdown.js +534 -0
- data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/core/grid.js +117 -0
- data/vendor/assets/javascripts/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/core/modal.js +387 -0
- data/vendor/assets/javascripts/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/core/nav.js +153 -0
- data/vendor/assets/javascripts/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/core/switcher.js +307 -0
- data/vendor/assets/javascripts/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/core/tab.js +169 -0
- data/vendor/assets/javascripts/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/core/toggle.js +124 -0
- data/vendor/assets/javascripts/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/core/touch.js +175 -0
- data/vendor/assets/javascripts/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/core/utility.js +335 -0
- data/vendor/assets/javascripts/core/utility.min.js +2 -0
- data/vendor/assets/javascripts/uikit.js +3898 -0
- data/vendor/assets/javascripts/uikit.min.js +3 -0
- data/vendor/assets/stylesheets/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/components/search.scss +309 -0
- data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
- data/vendor/assets/stylesheets/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/core/article.scss +139 -0
- data/vendor/assets/stylesheets/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/core/base.scss +563 -0
- data/vendor/assets/stylesheets/core/block.scss +155 -0
- data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/core/button.scss +406 -0
- data/vendor/assets/stylesheets/core/close.scss +132 -0
- data/vendor/assets/stylesheets/core/column.scss +209 -0
- data/vendor/assets/stylesheets/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
- data/vendor/assets/stylesheets/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/core/form.scss +629 -0
- data/vendor/assets/stylesheets/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/core/list.scss +102 -0
- data/vendor/assets/stylesheets/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/core/print.scss +61 -0
- data/vendor/assets/stylesheets/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/core/table.scss +147 -0
- data/vendor/assets/stylesheets/core/text.scss +136 -0
- data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit.scss +52 -0
- metadata +251 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideset",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i,e,n,s){var a,o,r,l,h=t.$.Deferred(),u=this.options.delay===!1?Math.floor(this.options.duration/2):this.options.delay,d=this;if(s=s||1,this.element.css("min-height",this.element.height()),n[0]===e[0])return h.resolve(),h.promise();if("object"==typeof i?(a=i[0],o=i[1]||i[0]):(a=i,o=a),t.$body.css("overflow-x","hidden"),r=function(){if(e&&e.length&&e.hide().removeClass(o+" uk-animation-reverse").css({opacity:"","animation-delay":"",animation:""}),!n.length)return h.resolve(),void 0;for(l=0;l<n.length;l++)n.eq(1==s?l:n.length-l-1).css("animation-delay",l*u+"ms");var i=function(){n.removeClass(""+a).css({opacity:"",display:"","animation-delay":"",animation:""}),h.resolve(),t.$body.css("overflow-x",""),d.element.css("min-height",""),i=!1};n.addClass(a)[1==s?"last":"first"]().one(t.support.animation.end,function(){i&&i()}).end().css("display",""),setTimeout(function(){i&&i()},n.length*u*2)},n.length&&n.css("animation-duration",this.options.duration+"ms"),e&&e.length)for(e.css("animation-duration",this.options.duration+"ms")[1==s?"last":"first"]().one(t.support.animation.end,function(){r()}),l=0;l<e.length;l++)!function(i,e){setTimeout(function(){e.css("display","none").css("display","").css("opacity",0).on(t.support.animation.end,function(){e.removeClass(o)}).addClass(o+" uk-animation-reverse")}.bind(this),l*u)}(l,e.eq(1==s?l:e.length-l-1));else r();return h.promise()}function e(t,i){var e,n=0,s=-1,a=t.length||0,o=[];if(1>i)return null;for(;a>n;)e=n%i,e?o[s][e]=t[n]:o[++s]=[t[n]],n++;for(n=0,a=o.length;a>n;)o[n]=jQuery(o[n]),n++;return o}var n;t.component("slideset",{defaults:{"default":1,animation:"fade",duration:200,filter:"",delay:!1,controls:!1,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},sets:[],boot:function(){t.ready(function(i){t.$("[data-uk-slideset]",i).each(function(){var i=t.$(this);i.data("slideset")||t.slideset(i,t.Utils.options(i.attr("data-uk-slideset")))})})},init:function(){var i=this;this.activeSet=!1,this.list=this.element.find(".uk-slideset"),this.nav=this.element.find(".uk-slideset-nav"),this.controls=this.options.controls?t.$(this.options.controls):this.element,t.$win.on("resize load",t.Utils.debounce(function(){i.update()},100)),i.list.addClass("uk-grid-width-1-"+i.options.default),["xlarge","large","medium","small"].forEach(function(t){i.options[t]&&i.list.addClass("uk-grid-width-"+t+"-1-"+i.options[t])}),this.on("click.uk.slideset","[data-uk-slideset-item]",function(e){if(e.preventDefault(),!i.animating){var n=t.$(this).attr("data-uk-slideset-item");if(i.activeSet!==n)switch(n){case"next":case"previous":i["next"==n?"next":"previous"]();break;default:i.show(parseInt(n,10))}}}),this.controls.on("click.uk.slideset","[data-uk-filter]",function(e){var n=t.$(this);n.parent().hasClass("uk-slideset")||(e.preventDefault(),i.animating||i.currentFilter==n.attr("data-uk-filter")||(i.updateFilter(n.attr("data-uk-filter")),i._hide().then(function(){i.update(!0,!0)})))}),this.on("swipeRight swipeLeft",function(t){i["swipeLeft"==t.type?"next":"previous"]()}),this.updateFilter(this.options.filter),this.update(),this.element.on({mouseenter:function(){i.options.pauseOnHover&&(i.hovering=!0)},mouseleave:function(){i.hovering=!1}}),this.options.autoplay&&this.start(),t.domObserve(this.list,function(){i.list.children(":visible:not(.uk-active)").length&&i.update(!1,!0)})},update:function(t,i){var n,s=this.visible;if(this.visible=this.getVisibleOnCurrenBreakpoint(),s!=this.visible||i){for(this.children=this.list.children().hide(),this.items=this.getItems(),this.sets=e(this.items,this.visible),n=0;n<this.sets.length;n++)this.sets[n].css({display:"none"});if(this.nav.length&&this.nav.empty()){for(n=0;n<this.sets.length;n++)this.nav.append('<li data-uk-slideset-item="'+n+'"><a></a></li>');this.nav[1==this.nav.children().length?"addClass":"removeClass"]("uk-invisible")}this.activeSet=!1,this.show(0,!t)}},updateFilter:function(i){var e,n=this;this.currentFilter=i,this.controls.find("[data-uk-filter]").each(function(){e=t.$(this),e.parent().hasClass("uk-slideset")||(e.attr("data-uk-filter")==n.currentFilter?e.addClass("uk-active"):e.removeClass("uk-active"))})},getVisibleOnCurrenBreakpoint:function(){var i=null,e=t.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo("body"),n=e.children().eq(0),s=this.options;return["xlarge","large","medium","small"].forEach(function(t){s[t]&&!i&&(e.attr("class","uk-grid-width-"+t+"-1-2").width(),50==n.width()&&(i=t))}),e.remove(),this.options[i]||this.options["default"]},getItems:function(){var i,e=[];return this.currentFilter?(i=this.currentFilter||[],"string"==typeof i&&(i=i.split(/,/).map(function(t){return t.trim()})),this.children.each(function(){var n=t.$(this),s=n.attr("data-uk-filter"),a=i.length?!1:!0;s&&(s=s.split(/,/).map(function(t){return t.trim()}),i.forEach(function(t){s.indexOf(t)>-1&&(a=!0)})),a&&e.push(n[0])}),e=t.$(e)):e=this.list.children(),e},show:function(i,e,s){var a=this;if(this.activeSet!==i&&!this.animating){s=s||(i<this.activeSet?-1:1);var o=this.sets[this.activeSet]||[],r=this.sets[i],l=this._getAnimation();(e||!t.support.animation)&&(l=n.none),this.animating=!0,this.nav.length&&this.nav.children().removeClass("uk-active").eq(i).addClass("uk-active"),l.apply(a,[o,r,s]).then(function(){t.Utils.checkDisplay(r,!0),a.children.hide().removeClass("uk-active"),r.addClass("uk-active").css({display:"",opacity:""}),a.animating=!1,a.activeSet=i,t.Utils.checkDisplay(r,!0),a.trigger("show.uk.slideset",[r])})}},_getAnimation:function(){var i=n[this.options.animation]||n.none;return t.support.animation||(i=n.none),i},_hide:function(){var t=this,i=this.sets[this.activeSet]||[],e=this._getAnimation();return this.animating=!0,e.apply(t,[i,[],1]).then(function(){t.animating=!1})},next:function(){this.show(this.sets[this.activeSet+1]?this.activeSet+1:0,!1,1)},previous:function(){this.show(this.sets[this.activeSet-1]?this.activeSet-1:this.sets.length-1,!1,-1)},start:function(){this.stop();var t=this;this.interval=setInterval(function(){t.hovering||t.animating||t.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)}}),n={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,e){return i.apply(this,["uk-animation-fade",t,e])},"slide-bottom":function(t,e){return i.apply(this,["uk-animation-slide-bottom",t,e])},"slide-top":function(t,e){return i.apply(this,["uk-animation-slide-top",t,e])},"slide-vertical":function(t,e,n){var s=["uk-animation-slide-top","uk-animation-slide-bottom"];return-1==n&&s.reverse(),i.apply(this,[s,t,e])},"slide-horizontal":function(t,e,n){var s=["uk-animation-slide-right","uk-animation-slide-left"];return-1==n&&s.reverse(),i.apply(this,[s,t,e,n])},scale:function(t,e){return i.apply(this,["uk-animation-scale-up",t,e])}},t.slideset.animations=n});
|
@@ -0,0 +1,382 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == 'function' && define.amd) {
|
11
|
+
define('uikit-slideshow-fx', ['uikit'], function() {
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI) {
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
var Animations = UI.slideshow.animations;
|
21
|
+
|
22
|
+
UI.$.extend(UI.slideshow.animations, {
|
23
|
+
slice: function(current, next, dir, fromfx) {
|
24
|
+
|
25
|
+
if (!current.data('cover')) {
|
26
|
+
return Animations.fade.apply(this, arguments);
|
27
|
+
}
|
28
|
+
|
29
|
+
var d = UI.$.Deferred();
|
30
|
+
|
31
|
+
var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
|
32
|
+
bgimage = next.data('cover').css('background-image'),
|
33
|
+
ghost = UI.$('<li class="uk-slideshow-ghost"></li>').css({
|
34
|
+
top : 0,
|
35
|
+
left : 0,
|
36
|
+
width : this.container.width(),
|
37
|
+
height : this.container.height(),
|
38
|
+
opacity: 1,
|
39
|
+
zIndex : 15
|
40
|
+
}),
|
41
|
+
ghostWidth = ghost.width(),
|
42
|
+
ghostHeight = ghost.height(),
|
43
|
+
pos = fromfx == 'slice-up' ? ghostHeight:'0',
|
44
|
+
bar;
|
45
|
+
|
46
|
+
for (var i = 0; i < this.options.slices; i++) {
|
47
|
+
|
48
|
+
if (fromfx == 'slice-up-down') {
|
49
|
+
pos = ((i % 2) + 2) % 2==0 ? '0':ghostHeight;
|
50
|
+
}
|
51
|
+
|
52
|
+
var width = (i == this.options.slices-1) ? sliceWidth : sliceWidth,
|
53
|
+
clipto = ('rect(0px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
|
54
|
+
clipfrom;
|
55
|
+
|
56
|
+
//slice-down - default
|
57
|
+
clipfrom = ('rect(0px, '+(width*(i+1))+'px, 0px, '+(sliceWidth*i)+'px)');
|
58
|
+
|
59
|
+
if (fromfx == 'slice-up' || (fromfx == 'slice-up-down' && ((i % 2) + 2) % 2==0 )) {
|
60
|
+
clipfrom = ('rect('+ghostHeight+'px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)');
|
61
|
+
}
|
62
|
+
|
63
|
+
bar = UI.$('<div class="uk-cover-background"></div>').css({
|
64
|
+
'position' : 'absolute',
|
65
|
+
'top' : 0,
|
66
|
+
'left' : 0,
|
67
|
+
'width' : ghostWidth,
|
68
|
+
'height' : ghostHeight,
|
69
|
+
'background-image' : bgimage,
|
70
|
+
'clip' : clipfrom,
|
71
|
+
'opacity' : 0,
|
72
|
+
'transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms',
|
73
|
+
'-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms'
|
74
|
+
|
75
|
+
}).data('clip', clipto);
|
76
|
+
|
77
|
+
ghost.append(bar);
|
78
|
+
}
|
79
|
+
|
80
|
+
this.container.append(ghost);
|
81
|
+
|
82
|
+
ghost.children().last().on(UI.support.transition.end, function() {
|
83
|
+
|
84
|
+
setTimeout(function() {
|
85
|
+
ghost.remove();
|
86
|
+
d.resolve();
|
87
|
+
}, 0);
|
88
|
+
});
|
89
|
+
|
90
|
+
ghost.width();
|
91
|
+
|
92
|
+
ghost.children().each(function() {
|
93
|
+
bar = UI.$(this);
|
94
|
+
bar.css({ clip: bar.data('clip'), opacity: 1 });
|
95
|
+
});
|
96
|
+
|
97
|
+
return d.promise();
|
98
|
+
},
|
99
|
+
|
100
|
+
'slice-up': function(current, next, dir) {
|
101
|
+
return Animations.slice.apply(this, [current, next, dir, 'slice-up']);
|
102
|
+
},
|
103
|
+
|
104
|
+
'slice-down': function(current, next, dir) {
|
105
|
+
return Animations.slice.apply(this, [current, next, dir, 'slice-down']);
|
106
|
+
},
|
107
|
+
|
108
|
+
'slice-up-down': function(current, next, dir) {
|
109
|
+
return Animations.slice.apply(this, [current, next, dir, 'slice-up-down']);
|
110
|
+
},
|
111
|
+
|
112
|
+
fold: function(current, next, dir) {
|
113
|
+
|
114
|
+
if (!next.data('cover')) {
|
115
|
+
return Animations.fade.apply(this, arguments);
|
116
|
+
}
|
117
|
+
|
118
|
+
var d = UI.$.Deferred();
|
119
|
+
|
120
|
+
var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
|
121
|
+
bgimage = next.data('cover').css('background-image'),
|
122
|
+
ghost = UI.$('<li class="uk-slideshow-ghost"></li>').css({
|
123
|
+
width : next.width(),
|
124
|
+
height : next.height(),
|
125
|
+
opacity: 1,
|
126
|
+
zIndex : 15
|
127
|
+
}),
|
128
|
+
ghostWidth = next.width(),
|
129
|
+
ghostHeight = next.height(),
|
130
|
+
bar;
|
131
|
+
|
132
|
+
for (var i = 0; i < this.options.slices; i++) {
|
133
|
+
|
134
|
+
bar = UI.$('<div class="uk-cover-background"></div>').css({
|
135
|
+
'position' : 'absolute',
|
136
|
+
'top' : 0,
|
137
|
+
'left' : 0,
|
138
|
+
'width' : ghostWidth,
|
139
|
+
'height' : ghostHeight,
|
140
|
+
'background-image' : bgimage,
|
141
|
+
'transform-origin' : (sliceWidth*i)+'px 0 0',
|
142
|
+
'clip' : ('rect(0px, '+(sliceWidth*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
|
143
|
+
'opacity' : 0,
|
144
|
+
'transform' : 'scaleX(0.000001)',
|
145
|
+
'transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms',
|
146
|
+
'-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms'
|
147
|
+
});
|
148
|
+
|
149
|
+
ghost.prepend(bar);
|
150
|
+
}
|
151
|
+
|
152
|
+
this.container.append(ghost);
|
153
|
+
|
154
|
+
ghost.width();
|
155
|
+
|
156
|
+
ghost.children().first().on(UI.support.transition.end, function() {
|
157
|
+
setTimeout(function() {
|
158
|
+
ghost.remove();
|
159
|
+
d.resolve();
|
160
|
+
}, 0);
|
161
|
+
}).end().css({
|
162
|
+
transform: 'scaleX(1)',
|
163
|
+
opacity: 1
|
164
|
+
});
|
165
|
+
|
166
|
+
return d.promise();
|
167
|
+
},
|
168
|
+
|
169
|
+
puzzle: function(current, next, dir) {
|
170
|
+
|
171
|
+
if (!next.data('cover')) {
|
172
|
+
return Animations.fade.apply(this, arguments);
|
173
|
+
}
|
174
|
+
|
175
|
+
var d = UI.$.Deferred(), $this = this;
|
176
|
+
|
177
|
+
var boxCols = Math.round(this.options.slices/2),
|
178
|
+
boxWidth = Math.round(next.width()/boxCols),
|
179
|
+
boxRows = Math.round(next.height()/boxWidth),
|
180
|
+
boxHeight = Math.round(next.height()/boxRows)+1,
|
181
|
+
bgimage = next.data('cover').css('background-image'),
|
182
|
+
ghost = UI.$('<li class="uk-slideshow-ghost"></li>').css({
|
183
|
+
width : this.container.width(),
|
184
|
+
height : this.container.height(),
|
185
|
+
opacity : 1,
|
186
|
+
zIndex : 15
|
187
|
+
}),
|
188
|
+
ghostWidth = this.container.width(),
|
189
|
+
ghostHeight = this.container.height(),
|
190
|
+
box, rect, width;
|
191
|
+
|
192
|
+
for (var rows = 0; rows < boxRows; rows++) {
|
193
|
+
|
194
|
+
for (var cols = 0; cols < boxCols; cols++) {
|
195
|
+
|
196
|
+
width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
|
197
|
+
|
198
|
+
rect = [
|
199
|
+
(boxHeight * rows) +'px', // top
|
200
|
+
(width * (cols+1)) +'px', // right
|
201
|
+
(boxHeight * (rows + 1)) +'px', // bottom
|
202
|
+
(boxWidth * cols) +'px' // left
|
203
|
+
];
|
204
|
+
|
205
|
+
box = UI.$('<div class="uk-cover-background"></div>').css({
|
206
|
+
'position' : 'absolute',
|
207
|
+
'top' : 0,
|
208
|
+
'left' : 0,
|
209
|
+
'opacity' : 0,
|
210
|
+
'width' : ghostWidth,
|
211
|
+
'height' : ghostHeight,
|
212
|
+
'background-image' : bgimage,
|
213
|
+
'clip' : ('rect('+rect.join(',')+')'),
|
214
|
+
'-webkit-transform' : 'translateZ(0)', // fixes webkit opacity flickering bug
|
215
|
+
'transform' : 'translateZ(0)' // fixes moz opacity flickering bug
|
216
|
+
});
|
217
|
+
|
218
|
+
ghost.append(box);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
this.container.append(ghost);
|
223
|
+
|
224
|
+
var boxes = shuffle(ghost.children());
|
225
|
+
|
226
|
+
boxes.each(function(i) {
|
227
|
+
UI.$(this).css({
|
228
|
+
'transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms',
|
229
|
+
'-webkit-transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms'
|
230
|
+
});
|
231
|
+
}).last().on(UI.support.transition.end, function() {
|
232
|
+
|
233
|
+
setTimeout(function() {
|
234
|
+
ghost.remove();
|
235
|
+
d.resolve();
|
236
|
+
}, 0);
|
237
|
+
});
|
238
|
+
|
239
|
+
ghost.width();
|
240
|
+
|
241
|
+
boxes.css({opacity: 1});
|
242
|
+
|
243
|
+
return d.promise();
|
244
|
+
},
|
245
|
+
|
246
|
+
boxes: function(current, next, dir, fromfx) {
|
247
|
+
|
248
|
+
if (!next.data('cover')) {
|
249
|
+
return Animations.fade.apply(this, arguments);
|
250
|
+
}
|
251
|
+
|
252
|
+
var d = UI.$.Deferred();
|
253
|
+
|
254
|
+
var boxCols = Math.round(this.options.slices/2),
|
255
|
+
boxWidth = Math.round(next.width()/boxCols),
|
256
|
+
boxRows = Math.round(next.height()/boxWidth),
|
257
|
+
boxHeight = Math.round(next.height()/boxRows)+1,
|
258
|
+
bgimage = next.data('cover').css('background-image'),
|
259
|
+
ghost = UI.$('<li class="uk-slideshow-ghost"></li>').css({
|
260
|
+
width : next.width(),
|
261
|
+
height : next.height(),
|
262
|
+
opacity : 1,
|
263
|
+
zIndex : 15
|
264
|
+
}),
|
265
|
+
ghostWidth = next.width(),
|
266
|
+
ghostHeight = next.height(),
|
267
|
+
box, rect, width, cols;
|
268
|
+
|
269
|
+
for (var rows = 0; rows < boxRows; rows++) {
|
270
|
+
|
271
|
+
for (cols = 0; cols < boxCols; cols++) {
|
272
|
+
|
273
|
+
width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
|
274
|
+
|
275
|
+
rect = [
|
276
|
+
(boxHeight * rows) +'px', // top
|
277
|
+
(width * (cols+1)) +'px', // right
|
278
|
+
(boxHeight * (rows + 1)) +'px', // bottom
|
279
|
+
(boxWidth * cols) +'px' // left
|
280
|
+
];
|
281
|
+
|
282
|
+
box = UI.$('<div class="uk-cover-background"></div>').css({
|
283
|
+
'position' : 'absolute',
|
284
|
+
'top' : 0,
|
285
|
+
'left' : 0,
|
286
|
+
'opacity' : 1,
|
287
|
+
'width' : ghostWidth,
|
288
|
+
'height' : ghostHeight,
|
289
|
+
'background-image' : bgimage,
|
290
|
+
'transform-origin' : rect[3]+' '+rect[0]+' 0',
|
291
|
+
'clip' : ('rect('+rect.join(',')+')'),
|
292
|
+
'-webkit-transform' : 'scale(0.0000000000000001)',
|
293
|
+
'transform' : 'scale(0.0000000000000001)'
|
294
|
+
});
|
295
|
+
|
296
|
+
ghost.append(box);
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
this.container.append(ghost);
|
301
|
+
|
302
|
+
var rowIndex = 0, colIndex = 0, timeBuff = 0, box2Darr = [[]], boxes = ghost.children(), prevCol;
|
303
|
+
|
304
|
+
if (fromfx == 'boxes-reverse') {
|
305
|
+
boxes = [].reverse.apply(boxes);
|
306
|
+
}
|
307
|
+
|
308
|
+
boxes.each(function() {
|
309
|
+
|
310
|
+
box2Darr[rowIndex][colIndex] = UI.$(this);
|
311
|
+
colIndex++;
|
312
|
+
|
313
|
+
if(colIndex == boxCols) {
|
314
|
+
rowIndex++;
|
315
|
+
colIndex = 0;
|
316
|
+
box2Darr[rowIndex] = [];
|
317
|
+
}
|
318
|
+
});
|
319
|
+
|
320
|
+
for (cols = 0, prevCol = 0; cols < (boxCols * boxRows); cols++) {
|
321
|
+
|
322
|
+
prevCol = cols;
|
323
|
+
|
324
|
+
for (var row = 0; row < boxRows; row++) {
|
325
|
+
|
326
|
+
if (prevCol >= 0 && prevCol < boxCols) {
|
327
|
+
|
328
|
+
box2Darr[row][prevCol].css({
|
329
|
+
'transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms',
|
330
|
+
'-webkit-transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms'
|
331
|
+
});
|
332
|
+
}
|
333
|
+
prevCol--;
|
334
|
+
}
|
335
|
+
timeBuff += 100;
|
336
|
+
}
|
337
|
+
|
338
|
+
boxes.last().on(UI.support.transition.end, function() {
|
339
|
+
|
340
|
+
setTimeout(function() {
|
341
|
+
ghost.remove();
|
342
|
+
d.resolve();
|
343
|
+
}, 0);
|
344
|
+
});
|
345
|
+
|
346
|
+
ghost.width();
|
347
|
+
|
348
|
+
boxes.css({
|
349
|
+
'-webkit-transform': 'scale(1)',
|
350
|
+
'transform': 'scale(1)'
|
351
|
+
});
|
352
|
+
|
353
|
+
return d.promise();
|
354
|
+
},
|
355
|
+
|
356
|
+
'boxes-reverse': function(current, next, dir) {
|
357
|
+
return Animations.boxes.apply(this, [current, next, dir, 'boxes-reverse']);
|
358
|
+
},
|
359
|
+
|
360
|
+
'random-fx': function(){
|
361
|
+
|
362
|
+
var animations = ['slice-up', 'fold', 'puzzle', 'slice-down', 'boxes', 'slice-up-down', 'boxes-reverse'];
|
363
|
+
|
364
|
+
this.fxIndex = (this.fxIndex === undefined ? -1 : this.fxIndex) + 1;
|
365
|
+
|
366
|
+
if (!animations[this.fxIndex]) this.fxIndex = 0;
|
367
|
+
|
368
|
+
return Animations[animations[this.fxIndex]].apply(this, arguments);
|
369
|
+
}
|
370
|
+
});
|
371
|
+
|
372
|
+
|
373
|
+
// helper functions
|
374
|
+
|
375
|
+
// Shuffle an array
|
376
|
+
var shuffle = function(arr) {
|
377
|
+
for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x) {}
|
378
|
+
return arr;
|
379
|
+
};
|
380
|
+
|
381
|
+
return UI.slideshow.animations;
|
382
|
+
});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow-fx",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t=i.slideshow.animations;i.$.extend(i.slideshow.animations,{slice:function(e,s,n,o){if(!e.data("cover"))return t.fade.apply(this,arguments);for(var r,a=i.$.Deferred(),c=Math.ceil(this.element.width()/this.options.slices),h=s.data("cover").css("background-image"),d=i.$('<li class="uk-slideshow-ghost"></li>').css({top:0,left:0,width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),p=d.width(),l=d.height(),u="slice-up"==o?l:"0",f=0;f<this.options.slices;f++){"slice-up-down"==o&&(u=(f%2+2)%2==0?"0":l);var m,g=f==this.options.slices-1?c:c,x="rect(0px, "+g*(f+1)+"px, "+l+"px, "+c*f+"px)";m="rect(0px, "+g*(f+1)+"px, 0px, "+c*f+"px)",("slice-up"==o||"slice-up-down"==o&&(f%2+2)%2==0)&&(m="rect("+l+"px, "+g*(f+1)+"px, "+l+"px, "+c*f+"px)"),r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:p,height:l,"background-image":h,clip:m,opacity:0,transition:"all "+this.options.duration+"ms ease-in-out "+60*f+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+60*f+"ms"}).data("clip",x),d.append(r)}return this.container.append(d),d.children().last().on(i.support.transition.end,function(){setTimeout(function(){d.remove(),a.resolve()},0)}),d.width(),d.children().each(function(){r=i.$(this),r.css({clip:r.data("clip"),opacity:1})}),a.promise()},"slice-up":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up"])},"slice-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-down"])},"slice-up-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up-down"])},fold:function(e,s){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var n,o=i.$.Deferred(),r=Math.ceil(this.element.width()/this.options.slices),a=s.data("cover").css("background-image"),c=i.$('<li class="uk-slideshow-ghost"></li>').css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),h=s.width(),d=s.height(),p=0;p<this.options.slices;p++)n=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:h,height:d,"background-image":a,"transform-origin":r*p+"px 0 0",clip:"rect(0px, "+r*(p+1)+"px, "+d+"px, "+r*p+"px)",opacity:0,transform:"scaleX(0.000001)",transition:"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms"}),c.prepend(n);return this.container.append(c),c.width(),c.children().first().on(i.support.transition.end,function(){setTimeout(function(){c.remove(),o.resolve()},0)}).end().css({transform:"scaleX(1)",opacity:1}),o.promise()},puzzle:function(s,n){if(!n.data("cover"))return t.fade.apply(this,arguments);for(var o,r,a,c=i.$.Deferred(),h=this,d=Math.round(this.options.slices/2),p=Math.round(n.width()/d),l=Math.round(n.height()/p),u=Math.round(n.height()/l)+1,f=n.data("cover").css("background-image"),m=i.$('<li class="uk-slideshow-ghost"></li>').css({width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),g=this.container.width(),x=this.container.height(),w=0;l>w;w++)for(var v=0;d>v;v++)a=v==d-1?p+2:p,r=[u*w+"px",a*(v+1)+"px",u*(w+1)+"px",p*v+"px"],o=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:0,width:g,height:x,"background-image":f,clip:"rect("+r.join(",")+")","-webkit-transform":"translateZ(0)",transform:"translateZ(0)"}),m.append(o);this.container.append(m);var k=e(m.children());return k.each(function(t){i.$(this).css({transition:"all "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms","-webkit-transition":"all "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms"})}).last().on(i.support.transition.end,function(){setTimeout(function(){m.remove(),c.resolve()},0)}),m.width(),k.css({opacity:1}),c.promise()},boxes:function(e,s,n,o){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var r,a,c,h,d=i.$.Deferred(),p=Math.round(this.options.slices/2),l=Math.round(s.width()/p),u=Math.round(s.height()/l),f=Math.round(s.height()/u)+1,m=s.data("cover").css("background-image"),g=i.$('<li class="uk-slideshow-ghost"></li>').css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),x=s.width(),w=s.height(),v=0;u>v;v++)for(h=0;p>h;h++)c=h==p-1?l+2:l,a=[f*v+"px",c*(h+1)+"px",f*(v+1)+"px",l*h+"px"],r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:1,width:x,height:w,"background-image":m,"transform-origin":a[3]+" "+a[0]+" 0",clip:"rect("+a.join(",")+")","-webkit-transform":"scale(0.0000000000000001)",transform:"scale(0.0000000000000001)"}),g.append(r);this.container.append(g);var k,b=0,y=0,$=0,I=[[]],M=g.children();for("boxes-reverse"==o&&(M=[].reverse.apply(M)),M.each(function(){I[b][y]=i.$(this),y++,y==p&&(b++,y=0,I[b]=[])}),h=0,k=0;p*u>h;h++){k=h;for(var z=0;u>z;z++)k>=0&&p>k&&I[z][k].css({transition:"all "+this.options.duration+"ms linear "+(50+$)+"ms","-webkit-transition":"all "+this.options.duration+"ms linear "+(50+$)+"ms"}),k--;$+=100}return M.last().on(i.support.transition.end,function(){setTimeout(function(){g.remove(),d.resolve()},0)}),g.width(),M.css({"-webkit-transform":"scale(1)",transform:"scale(1)"}),d.promise()},"boxes-reverse":function(i,e,s){return t.boxes.apply(this,[i,e,s,"boxes-reverse"])},"random-fx":function(){var i=["slice-up","fold","puzzle","slice-down","boxes","slice-up-down","boxes-reverse"];return this.fxIndex=(void 0===this.fxIndex?-1:this.fxIndex)+1,i[this.fxIndex]||(this.fxIndex=0),t[i[this.fxIndex]].apply(this,arguments)}});var e=function(i){for(var t,e,s=i.length;s;t=parseInt(Math.random()*s),e=i[--s],i[s]=i[t],i[t]=e);return i};return i.slideshow.animations});
|
@@ -0,0 +1,596 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == 'function' && define.amd) {
|
11
|
+
define('uikit-slideshow', ['uikit'], function() {
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI) {
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
var Animations, playerId = 0;
|
21
|
+
|
22
|
+
UI.component('slideshow', {
|
23
|
+
|
24
|
+
defaults: {
|
25
|
+
animation : 'fade',
|
26
|
+
duration : 500,
|
27
|
+
height : 'auto',
|
28
|
+
start : 0,
|
29
|
+
autoplay : false,
|
30
|
+
autoplayInterval : 7000,
|
31
|
+
videoautoplay : true,
|
32
|
+
videomute : true,
|
33
|
+
slices : 15,
|
34
|
+
pauseOnHover : true,
|
35
|
+
kenburns : false,
|
36
|
+
kenburnsanimations : [
|
37
|
+
'uk-animation-middle-left',
|
38
|
+
'uk-animation-top-right',
|
39
|
+
'uk-animation-bottom-left',
|
40
|
+
'uk-animation-top-center',
|
41
|
+
'', // middle-center
|
42
|
+
'uk-animation-bottom-right'
|
43
|
+
]
|
44
|
+
},
|
45
|
+
|
46
|
+
current : false,
|
47
|
+
interval : null,
|
48
|
+
hovering : false,
|
49
|
+
|
50
|
+
boot: function() {
|
51
|
+
|
52
|
+
// init code
|
53
|
+
UI.ready(function(context) {
|
54
|
+
|
55
|
+
UI.$('[data-uk-slideshow]', context).each(function() {
|
56
|
+
|
57
|
+
var slideshow = UI.$(this);
|
58
|
+
|
59
|
+
if (!slideshow.data('slideshow')) {
|
60
|
+
UI.slideshow(slideshow, UI.Utils.options(slideshow.attr('data-uk-slideshow')));
|
61
|
+
}
|
62
|
+
});
|
63
|
+
});
|
64
|
+
},
|
65
|
+
|
66
|
+
init: function() {
|
67
|
+
|
68
|
+
var $this = this;
|
69
|
+
|
70
|
+
this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow:first'));
|
71
|
+
this.current = this.options.start;
|
72
|
+
this.animating = false;
|
73
|
+
|
74
|
+
this.fixFullscreen = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && this.container.hasClass('uk-slideshow-fullscreen'); // viewport unit fix for height:100vh - should be fixed in iOS 8
|
75
|
+
|
76
|
+
if (this.options.kenburns) {
|
77
|
+
|
78
|
+
this.kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
|
79
|
+
|
80
|
+
if (!String(this.kbanimduration).match(/(ms|s)$/)) {
|
81
|
+
this.kbanimduration += 'ms';
|
82
|
+
}
|
83
|
+
|
84
|
+
if (typeof(this.options.kenburnsanimations) == 'string') {
|
85
|
+
this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
this.update();
|
90
|
+
|
91
|
+
this.on('click.uk.slideshow', '[data-uk-slideshow-item]', function(e) {
|
92
|
+
|
93
|
+
e.preventDefault();
|
94
|
+
|
95
|
+
var slide = UI.$(this).attr('data-uk-slideshow-item');
|
96
|
+
|
97
|
+
if ($this.current == slide) return;
|
98
|
+
|
99
|
+
switch(slide) {
|
100
|
+
case 'next':
|
101
|
+
case 'previous':
|
102
|
+
$this[slide=='next' ? 'next':'previous']();
|
103
|
+
break;
|
104
|
+
default:
|
105
|
+
$this.show(parseInt(slide, 10));
|
106
|
+
}
|
107
|
+
|
108
|
+
$this.stop();
|
109
|
+
});
|
110
|
+
|
111
|
+
UI.$win.on("resize load", UI.Utils.debounce(function() {
|
112
|
+
$this.resize();
|
113
|
+
|
114
|
+
if ($this.fixFullscreen) {
|
115
|
+
$this.container.css('height', window.innerHeight);
|
116
|
+
$this.slides.css('height', window.innerHeight);
|
117
|
+
}
|
118
|
+
}, 100));
|
119
|
+
|
120
|
+
// chrome image load fix
|
121
|
+
setTimeout(function(){
|
122
|
+
$this.resize();
|
123
|
+
}, 80);
|
124
|
+
|
125
|
+
// Set autoplay
|
126
|
+
if (this.options.autoplay) {
|
127
|
+
this.start();
|
128
|
+
}
|
129
|
+
|
130
|
+
if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
|
131
|
+
this.playmedia(this.slides.eq(this.current).data('media'));
|
132
|
+
}
|
133
|
+
|
134
|
+
if (this.options.kenburns) {
|
135
|
+
this.applyKenBurns(this.slides.eq(this.current));
|
136
|
+
}
|
137
|
+
|
138
|
+
this.container.on({
|
139
|
+
mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
|
140
|
+
mouseleave: function() { $this.hovering = false; }
|
141
|
+
});
|
142
|
+
|
143
|
+
this.on('swipeRight swipeLeft', function(e) {
|
144
|
+
$this[e.type=='swipeLeft' ? 'next' : 'previous']();
|
145
|
+
});
|
146
|
+
|
147
|
+
this.on('display.uk.check', function(){
|
148
|
+
if ($this.element.is(':visible')) {
|
149
|
+
|
150
|
+
$this.resize();
|
151
|
+
|
152
|
+
if ($this.fixFullscreen) {
|
153
|
+
$this.container.css('height', window.innerHeight);
|
154
|
+
$this.slides.css('height', window.innerHeight);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
});
|
158
|
+
|
159
|
+
UI.domObserve(this.element, function(e) {
|
160
|
+
if ($this.container.children(':not([data-slideshow-slide])').not('.uk-slideshow-ghost').length) {
|
161
|
+
$this.update(true);
|
162
|
+
}
|
163
|
+
});
|
164
|
+
},
|
165
|
+
|
166
|
+
update: function(resize) {
|
167
|
+
|
168
|
+
var $this = this, canvas, processed = 0;
|
169
|
+
|
170
|
+
this.slides = this.container.children();
|
171
|
+
this.slidesCount = this.slides.length;
|
172
|
+
|
173
|
+
if (!this.slides.eq(this.current).length) {
|
174
|
+
this.current = 0;
|
175
|
+
}
|
176
|
+
|
177
|
+
this.slides.each(function(index) {
|
178
|
+
|
179
|
+
var slide = UI.$(this);
|
180
|
+
|
181
|
+
if (slide.data('processed')) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
|
185
|
+
var media = slide.children('img,video,iframe').eq(0), type = 'html';
|
186
|
+
|
187
|
+
slide.data('media', media);
|
188
|
+
slide.data('sizer', media);
|
189
|
+
|
190
|
+
if (media.length) {
|
191
|
+
|
192
|
+
var placeholder;
|
193
|
+
|
194
|
+
type = media[0].nodeName.toLowerCase();
|
195
|
+
|
196
|
+
switch(media[0].nodeName) {
|
197
|
+
case 'IMG':
|
198
|
+
|
199
|
+
var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
|
200
|
+
|
201
|
+
if (media.attr('width') && media.attr('height')) {
|
202
|
+
placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')});
|
203
|
+
media.replaceWith(placeholder);
|
204
|
+
media = placeholder;
|
205
|
+
placeholder = undefined;
|
206
|
+
}
|
207
|
+
|
208
|
+
media.css({width: '100%',height: 'auto', opacity:0});
|
209
|
+
slide.prepend(cover).data('cover', cover);
|
210
|
+
break;
|
211
|
+
|
212
|
+
case 'IFRAME':
|
213
|
+
|
214
|
+
var src = media[0].src, iframeId = 'sw-'+(++playerId);
|
215
|
+
|
216
|
+
media
|
217
|
+
.attr('src', '').on('load', function(){
|
218
|
+
|
219
|
+
if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
|
220
|
+
$this.pausemedia(media);
|
221
|
+
}
|
222
|
+
|
223
|
+
if ($this.options.videomute) {
|
224
|
+
|
225
|
+
$this.mutemedia(media);
|
226
|
+
|
227
|
+
var inv = setInterval((function(ic) {
|
228
|
+
return function() {
|
229
|
+
$this.mutemedia(media);
|
230
|
+
if (++ic >= 4) clearInterval(inv);
|
231
|
+
}
|
232
|
+
})(0), 250);
|
233
|
+
}
|
234
|
+
|
235
|
+
})
|
236
|
+
.data('slideshow', $this) // add self-reference for the vimeo-ready listener
|
237
|
+
.attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
|
238
|
+
.attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
|
239
|
+
.addClass('uk-position-absolute');
|
240
|
+
|
241
|
+
// disable pointer events
|
242
|
+
if(!UI.support.touch) media.css('pointer-events', 'none');
|
243
|
+
|
244
|
+
placeholder = true;
|
245
|
+
|
246
|
+
if (UI.cover) {
|
247
|
+
UI.cover(media);
|
248
|
+
media.attr('data-uk-cover', '{}');
|
249
|
+
}
|
250
|
+
|
251
|
+
break;
|
252
|
+
|
253
|
+
case 'VIDEO':
|
254
|
+
media.addClass('uk-cover-object uk-position-absolute');
|
255
|
+
placeholder = true;
|
256
|
+
|
257
|
+
if ($this.options.videomute) $this.mutemedia(media);
|
258
|
+
}
|
259
|
+
|
260
|
+
if (placeholder) {
|
261
|
+
|
262
|
+
canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
|
263
|
+
var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
|
264
|
+
|
265
|
+
slide.prepend(img);
|
266
|
+
slide.data('sizer', img);
|
267
|
+
}
|
268
|
+
|
269
|
+
} else {
|
270
|
+
slide.data('sizer', slide);
|
271
|
+
}
|
272
|
+
|
273
|
+
if ($this.hasKenBurns(slide)) {
|
274
|
+
|
275
|
+
slide.data('cover').css({
|
276
|
+
'-webkit-animation-duration': $this.kbanimduration,
|
277
|
+
'animation-duration': $this.kbanimduration
|
278
|
+
});
|
279
|
+
}
|
280
|
+
|
281
|
+
slide.data('processed', ++processed);
|
282
|
+
slide.attr('data-slideshow-slide', type);
|
283
|
+
});
|
284
|
+
|
285
|
+
if (processed) {
|
286
|
+
|
287
|
+
this.triggers = this.find('[data-uk-slideshow-item]');
|
288
|
+
|
289
|
+
// Set start slide
|
290
|
+
this.slides.attr('aria-hidden', 'true').removeClass('uk-active').eq(this.current).addClass('uk-active').attr('aria-hidden', 'false');
|
291
|
+
this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass('uk-active');
|
292
|
+
}
|
293
|
+
|
294
|
+
if (resize && processed) {
|
295
|
+
this.resize();
|
296
|
+
}
|
297
|
+
},
|
298
|
+
|
299
|
+
resize: function() {
|
300
|
+
|
301
|
+
if (this.container.hasClass('uk-slideshow-fullscreen')) return;
|
302
|
+
|
303
|
+
var height = this.options.height;
|
304
|
+
|
305
|
+
if (this.options.height === 'auto') {
|
306
|
+
|
307
|
+
height = 0;
|
308
|
+
|
309
|
+
this.slides.css('height', '').each(function() {
|
310
|
+
height = Math.max(height, UI.$(this).height());
|
311
|
+
});
|
312
|
+
}
|
313
|
+
|
314
|
+
this.container.css('height', height);
|
315
|
+
this.slides.css('height', height);
|
316
|
+
},
|
317
|
+
|
318
|
+
show: function(index, direction) {
|
319
|
+
|
320
|
+
if (this.animating || this.current == index) return;
|
321
|
+
|
322
|
+
this.animating = true;
|
323
|
+
|
324
|
+
var $this = this,
|
325
|
+
current = this.slides.eq(this.current),
|
326
|
+
next = this.slides.eq(index),
|
327
|
+
dir = direction ? direction : this.current < index ? 1 : -1,
|
328
|
+
currentmedia = current.data('media'),
|
329
|
+
animation = Animations[this.options.animation] ? this.options.animation : 'fade',
|
330
|
+
nextmedia = next.data('media'),
|
331
|
+
finalize = function() {
|
332
|
+
|
333
|
+
if (!$this.animating) return;
|
334
|
+
|
335
|
+
if (currentmedia && currentmedia.is('video,iframe')) {
|
336
|
+
$this.pausemedia(currentmedia);
|
337
|
+
}
|
338
|
+
|
339
|
+
if (nextmedia && nextmedia.is('video,iframe')) {
|
340
|
+
$this.playmedia(nextmedia);
|
341
|
+
}
|
342
|
+
|
343
|
+
next.addClass('uk-active').attr('aria-hidden', 'false');
|
344
|
+
current.removeClass('uk-active').attr('aria-hidden', 'true');
|
345
|
+
|
346
|
+
$this.animating = false;
|
347
|
+
$this.current = index;
|
348
|
+
|
349
|
+
UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
|
350
|
+
|
351
|
+
$this.trigger('show.uk.slideshow', [next, current, $this]);
|
352
|
+
};
|
353
|
+
|
354
|
+
$this.applyKenBurns(next);
|
355
|
+
|
356
|
+
// animation fallback
|
357
|
+
if (!UI.support.animation) {
|
358
|
+
animation = 'none';
|
359
|
+
}
|
360
|
+
|
361
|
+
current = UI.$(current);
|
362
|
+
next = UI.$(next);
|
363
|
+
|
364
|
+
$this.trigger('beforeshow.uk.slideshow', [next, current, $this]);
|
365
|
+
|
366
|
+
Animations[animation].apply(this, [current, next, dir]).then(finalize);
|
367
|
+
|
368
|
+
$this.triggers.removeClass('uk-active');
|
369
|
+
$this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
|
370
|
+
},
|
371
|
+
|
372
|
+
applyKenBurns: function(slide) {
|
373
|
+
|
374
|
+
if (!this.hasKenBurns(slide)) {
|
375
|
+
return;
|
376
|
+
}
|
377
|
+
|
378
|
+
var animations = this.options.kenburnsanimations,
|
379
|
+
index = this.kbindex || 0;
|
380
|
+
|
381
|
+
|
382
|
+
slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
|
383
|
+
slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
|
384
|
+
|
385
|
+
this.kbindex = animations[index + 1] ? (index+1):0;
|
386
|
+
},
|
387
|
+
|
388
|
+
hasKenBurns: function(slide) {
|
389
|
+
return (this.options.kenburns && slide.data('cover'));
|
390
|
+
},
|
391
|
+
|
392
|
+
next: function() {
|
393
|
+
this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1);
|
394
|
+
},
|
395
|
+
|
396
|
+
previous: function() {
|
397
|
+
this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1);
|
398
|
+
},
|
399
|
+
|
400
|
+
start: function() {
|
401
|
+
|
402
|
+
this.stop();
|
403
|
+
|
404
|
+
var $this = this;
|
405
|
+
|
406
|
+
this.interval = setInterval(function() {
|
407
|
+
if (!$this.hovering) $this.next();
|
408
|
+
}, this.options.autoplayInterval);
|
409
|
+
|
410
|
+
},
|
411
|
+
|
412
|
+
stop: function() {
|
413
|
+
if (this.interval) clearInterval(this.interval);
|
414
|
+
},
|
415
|
+
|
416
|
+
playmedia: function(media) {
|
417
|
+
|
418
|
+
if (!(media && media[0])) return;
|
419
|
+
|
420
|
+
switch(media[0].nodeName) {
|
421
|
+
case 'VIDEO':
|
422
|
+
|
423
|
+
if (!this.options.videomute) {
|
424
|
+
media[0].muted = false;
|
425
|
+
}
|
426
|
+
|
427
|
+
media[0].play();
|
428
|
+
break;
|
429
|
+
case 'IFRAME':
|
430
|
+
|
431
|
+
if (!this.options.videomute) {
|
432
|
+
media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
|
433
|
+
}
|
434
|
+
|
435
|
+
media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
|
436
|
+
break;
|
437
|
+
}
|
438
|
+
},
|
439
|
+
|
440
|
+
pausemedia: function(media) {
|
441
|
+
|
442
|
+
switch(media[0].nodeName) {
|
443
|
+
case 'VIDEO':
|
444
|
+
media[0].pause();
|
445
|
+
break;
|
446
|
+
case 'IFRAME':
|
447
|
+
media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
|
448
|
+
break;
|
449
|
+
}
|
450
|
+
},
|
451
|
+
|
452
|
+
mutemedia: function(media) {
|
453
|
+
|
454
|
+
switch(media[0].nodeName) {
|
455
|
+
case 'VIDEO':
|
456
|
+
media[0].muted = true;
|
457
|
+
break;
|
458
|
+
case 'IFRAME':
|
459
|
+
media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
460
|
+
break;
|
461
|
+
}
|
462
|
+
}
|
463
|
+
});
|
464
|
+
|
465
|
+
Animations = {
|
466
|
+
|
467
|
+
'none': function() {
|
468
|
+
|
469
|
+
var d = UI.$.Deferred();
|
470
|
+
d.resolve();
|
471
|
+
return d.promise();
|
472
|
+
},
|
473
|
+
|
474
|
+
'scroll': function(current, next, dir) {
|
475
|
+
|
476
|
+
var d = UI.$.Deferred();
|
477
|
+
|
478
|
+
current.css('animation-duration', this.options.duration+'ms');
|
479
|
+
next.css('animation-duration', this.options.duration+'ms');
|
480
|
+
|
481
|
+
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
482
|
+
|
483
|
+
current.css('opacity', 0).removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
|
484
|
+
next.removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
|
485
|
+
d.resolve();
|
486
|
+
|
487
|
+
}.bind(this));
|
488
|
+
|
489
|
+
current.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
|
490
|
+
next.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
|
491
|
+
next.width(); // force redraw
|
492
|
+
|
493
|
+
return d.promise();
|
494
|
+
},
|
495
|
+
|
496
|
+
'swipe': function(current, next, dir) {
|
497
|
+
|
498
|
+
var d = UI.$.Deferred();
|
499
|
+
|
500
|
+
current.css('animation-duration', this.options.duration+'ms');
|
501
|
+
next.css('animation-duration', this.options.duration+'ms');
|
502
|
+
|
503
|
+
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
504
|
+
|
505
|
+
current.css('opacity', 0).removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
|
506
|
+
next.removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
|
507
|
+
d.resolve();
|
508
|
+
|
509
|
+
}.bind(this));
|
510
|
+
|
511
|
+
current.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
|
512
|
+
next.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
|
513
|
+
next.width(); // force redraw
|
514
|
+
|
515
|
+
return d.promise();
|
516
|
+
},
|
517
|
+
|
518
|
+
'scale': function(current, next, dir) {
|
519
|
+
|
520
|
+
var d = UI.$.Deferred();
|
521
|
+
|
522
|
+
current.css('animation-duration', this.options.duration+'ms');
|
523
|
+
next.css('animation-duration', this.options.duration+'ms');
|
524
|
+
|
525
|
+
next.css('opacity', 1);
|
526
|
+
|
527
|
+
current.one(UI.support.animation.end, function() {
|
528
|
+
|
529
|
+
current.css('opacity', 0).removeClass('uk-slideshow-scale-out');
|
530
|
+
d.resolve();
|
531
|
+
|
532
|
+
}.bind(this));
|
533
|
+
|
534
|
+
current.addClass('uk-slideshow-scale-out');
|
535
|
+
current.width(); // force redraw
|
536
|
+
|
537
|
+
return d.promise();
|
538
|
+
},
|
539
|
+
|
540
|
+
'fade': function(current, next, dir) {
|
541
|
+
|
542
|
+
var d = UI.$.Deferred();
|
543
|
+
|
544
|
+
current.css('animation-duration', this.options.duration+'ms');
|
545
|
+
next.css('animation-duration', this.options.duration+'ms');
|
546
|
+
|
547
|
+
next.css('opacity', 1);
|
548
|
+
|
549
|
+
// for plain text content slides - looks smoother
|
550
|
+
if (!(next.data('cover') || next.data('placeholder'))) {
|
551
|
+
|
552
|
+
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
553
|
+
next.removeClass('uk-slideshow-fade-in');
|
554
|
+
}).addClass('uk-slideshow-fade-in');
|
555
|
+
}
|
556
|
+
|
557
|
+
current.one(UI.support.animation.end, function() {
|
558
|
+
|
559
|
+
current.css('opacity', 0).removeClass('uk-slideshow-fade-out');
|
560
|
+
d.resolve();
|
561
|
+
|
562
|
+
}.bind(this));
|
563
|
+
|
564
|
+
current.addClass('uk-slideshow-fade-out');
|
565
|
+
current.width(); // force redraw
|
566
|
+
|
567
|
+
return d.promise();
|
568
|
+
}
|
569
|
+
};
|
570
|
+
|
571
|
+
UI.slideshow.animations = Animations;
|
572
|
+
|
573
|
+
// Listen for messages from the vimeo player
|
574
|
+
window.addEventListener('message', function onMessageReceived(e) {
|
575
|
+
|
576
|
+
var data = e.data, iframe;
|
577
|
+
|
578
|
+
if (typeof(data) == 'string') {
|
579
|
+
|
580
|
+
try {
|
581
|
+
data = JSON.parse(data);
|
582
|
+
} catch(err) {
|
583
|
+
data = {};
|
584
|
+
}
|
585
|
+
}
|
586
|
+
|
587
|
+
if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
|
588
|
+
iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
|
589
|
+
|
590
|
+
if (iframe.length) {
|
591
|
+
iframe.data('slideshow').mutemedia(iframe);
|
592
|
+
}
|
593
|
+
}
|
594
|
+
}, false);
|
595
|
+
|
596
|
+
});
|