diff --git a/README.md b/README.md index 7a585eb8..a7e81faf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # tiny-slider -![version](https://img.shields.io/badge/Version-0.4.0-green.svg) +![version](https://img.shields.io/badge/Version-0.4.1-green.svg) Tiny slider for all purposes, inspired by [Owl Carousel](http://owlcarousel.owlgraphic.com/). Works on morden browsers and IE8+. [demo](http://creatiointl.org/william/tiny-slider/v1/demo/) @@ -90,6 +90,7 @@ Default: container: document.querySelector('.slider'), items: 1, gutter: 0, + gutterPosition: 'right', fixedWidth: false, maxContainerWidth: false, slideByPage: false, diff --git a/bower.json b/bower.json index 8f6f26db..6c8ac872 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tiny-slider", - "version": "0.4.0", + "version": "0.4.1", "homepage": "https://github.com/ganlanyuan/tiny-slider", "authors": [ "WilliamLin " diff --git a/changelog.md b/changelog.md index 2aa47a33..8ed1ac77 100644 --- a/changelog.md +++ b/changelog.md @@ -27,6 +27,10 @@ class `tiny-next` => attribute `[data-controls="next"`. - Fixed: an issue with `items`, when container width is shorter than one slide in fixedWidth slider. --> +#### v0.4.1 +- Added: `gutterPosition` option. +- Fixed: `margin` attribute is added even gutter is 0. + #### v0.4.0 - Added: `gutter` option. - Renamed `tiny-slider.helper.ie8.js` to `tiny-slider.ie8.js`. diff --git a/demo/index.html b/demo/index.html index fb237310..9a78730a 100644 --- a/demo/index.html +++ b/demo/index.html @@ -131,6 +131,7 @@ tinySlider({ container: document.querySelector('.responsive'), gutter: 10, + gutterPosition: 'left', responsive: { 500: 2, 800: 3, @@ -140,6 +141,7 @@ tinySlider({ container: document.querySelector('.fixed-width'), gutter: 10, + gutterPosition: 'left', fixedWidth: 200, maxContainerWidth: 900, loop: false @@ -529,23 +531,23 @@

arrow keys

auto height

- +

Lorem ipsum dolor sit amet

- +

Blanditiis sapiente tempora

- +

At possimus dolorum eligendi repellat

- +

Neque accusamus inventore rerum

- +

Quis deserunt quo sequi qui fugiat nobis

diff --git a/dist/min/tiny-slider.js b/dist/min/tiny-slider.js index 06af40fd..3a8f9fad 100644 --- a/dist/min/tiny-slider.js +++ b/dist/min/tiny-slider.js @@ -1,2 +1,2 @@ -!function(){"use strict";var t,e,n,i,r=window,o=document,a=Object,l=null,u=!0,s=!1,d=" ",c="Element",f="create"+c,v="DOMTokenList",m="__defineGetter__",h="defineProperty",p="class",b="List",g=p+b,y="rel",A=y+b,w="div",E="length",L="contains",x="apply",C="HTML",M=("item "+L+" add remove toggle toString toLocaleString").split(d),T=M[2],N=M[3],S=M[4],k="prototype",P=h in a||m in a[k]||l,D=function(t,e,n,i){a[h]?a[h](t,e,{configurable:s===P?u:!!i,get:n}):t[m](e,n)},W=function(e,n){var i=this,r=[],o={},l=0,c=0,f=function(){if(l>=c)for(;c>>0,e[n]=r.join(d),f())},i[N]=function(){v[x](i,t=arguments);for(var t,a={},s=0,c=[];s>>0,e[n]=r.join(d),f()},i[S]=function(e,n){return v[x](i,[e]),t!==n?n?(i[T](e),u):(i[N](e),s):o[e]?(i[N](e),s):(i[T](e),u)},function(t,e){if(e)for(var n=0;n<7;++n)e(t,M[n],{enumerable:s})}(i,a[h]),i},O=function(t,e,n){D(t[k],e,function(){var t,i=this,r=m+h+e;if(i[r])return t;if(i[r]=u,s===P){for(var a,l=O.mirror=O.mirror||o[f](w),d=l.childNodes,c=d[E],v=0;ve[E]&&(n=k[T],i=k[N],k[T]=function(){for(var t=0,e=arguments;t0&&e.right>0&&e.top0?e.cloneNode(!0):e,o=n[i],a=o.parentNode,l=o.nextSibling;r.appendChild(o),l?a.insertBefore(r,l):a.appendChild(r)}},gn.unwrap=function(t){for(var e=gn.isNodeList(t)?t:[t],n=e.length;n--;){for(var i=e[n],r=i.parentNode;i.firstChild;)r.insertBefore(i.firstChild,i);r.removeChild(i)}},Date.now||(Date.now=function(){return(new Date).getTime()}),function(){"use strict";for(var t=["webkit","moz"],e=0;e=t&&n=e&&i=e&&t_?(0===Et?(X.disabled=!0,D(X,K)):X.disabled=!1,Et===et-_?(K.disabled=!0,D(K,X)):K.disabled=!1):(0!==Et&&(Et=0,y()),X.disabled=!0,K.disabled=!0,X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","-1"),X===document.activeElement&&X.blur(),K===document.activeElement&&K.blur()))}function b(){if(ut&&!t.navContainer)for(var e=Y;e--;){var n=V[e];e<$?n.hasAttribute("hidden")&&n.removeAttribute("hidden"):n.hasAttribute("hidden")||n.setAttribute("hidden","")}}function g(){if(ut){var e;if(wt===-1){var n=Et<0?Et+et:Et>=et?Et-et:Et;if(e=t.navContainer?n:Math.floor(n/_),!pt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/_);r||Et!==et-_||(e+=1)}}else e=wt,wt=-1;for(var o=$;o--;){var a=V[o];o===e?"false"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","0"),a.setAttribute("aria-selected","true")):"true"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false"))}}}function y(){var t=Q.parentNode.offsetWidth;kt=-B*Et,rt&&!pt&&(kt=Math.max(kt,-Math.abs(et*B-it-t))),a?Q.style[a]="translate3d("+kt+"px, 0, 0)":Q.style.left=kt+"px"}function A(){u(),m(),y(),b(),g(),h(),p(),bt&&c(),yt&&F()}function w(){if(pt){var t=gt?Et<_-U:Et<=-U,e=gt?Et>et+U-2*_-1:Et>=et+U-_;rt&&U&&!gt&&(e=Et>=et+U-_-1),t&&(Et+=et),e&&(Et-=et),o&&(Q.style[o]="0s"),y()}}function E(t){Q.setAttribute("aria-busy","true"),v(t),y(),setTimeout(function(){w(),h(),p(),g(),F(),bt&&c(),Lt=!1,Q.setAttribute("aria-busy","false")},ct*t)}function L(t){if(!Lt){t=gt?t*_:t;var e=Math.abs(t);Et=pt?Et+t:Math.max(0,Math.min(Et+t,et-_)),E(e)}}function x(){L(-1)}function C(){L(1)}function M(e){if(!Lt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;wt=n=Number(i.getAttribute("data-slide"));var r,o;r=t.navContainer?n:n*_,r=pt?r:Math.min(r,et-_),o=Math.abs(r-Et),Et=r,E(o)}}function T(){Ct=setInterval(function(){L(mt)},vt),Mt.setAttribute("data-action","stop"),Mt.innerHTML=""+ht[1],Tt=!0}function N(){clearInterval(Ct),Mt.setAttribute("data-action","start"),Mt.innerHTML=""+ht[0],Tt=!1}function S(){Tt?N():T()}function k(){Tt&&N()}function P(t){t=t||window.event,t.keyCode===l.LEFT?L(-1):t.keyCode===l.RIGHT&&L(1)}function D(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function W(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.UP&&e!==l.HOME&&e!==l.PAGEUP||n!==X&&X.disabled!==!0&&D(n,X),e!==l.RIGHT&&e!==l.DOWN&&e!==l.END&&e!==l.PAGEDOWN||n!==K&&K.disabled!==!0&&D(n,K),e!==l.ENTER&&e!==l.SPACE||(n===K?C():x())}function O(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.PAGEUP||n.getAttribute("data-slide")>0&&D(n,n.previousElementSibling),e!==l.UP&&e!==l.HOME||0!==n.getAttribute("data-slide")&&D(n,V[0]),e!==l.RIGHT&&e!==l.PAGEDOWN||n.getAttribute("data-slide")<$-1&&D(n,n.nextElementSibling),e!==l.DOWN&&e!==l.END||n.getAttribute("data-slide")<$-1&&D(n,V[$-1]),e!==l.ENTER&&e!==l.SPACE||M(t)}function F(){if(gn.isInViewport(Q)){var t=Q.querySelectorAll('[aria-hidden="false"] .tiny-lazy');if(0!==t.length)for(var e=0,n=t.length;e=Ft[Ft.length-1])e=qt[qt.length-1];else for(var i=0;i=Ft[i]&&n<=Ft[i+1]&&(e=qt[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),Ht=function(){var e;return e=rt?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/rt):void 0!==qt.length?Math.max.apply(Math,qt):t.items,e?Math.min(et,e):e},jt=function(){return rt?function(){return rt+it}:function(){return(Q.parentNode.offsetWidth+it)/_}}(),Rt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/_)}}(),Gt=function(){return pt?function(){return Et+U}:function(){return Et}}();return _=It(),U=Ht(),B=jt(),$=Rt(),{init:function(){Q.classList.add("tiny-content"),0===Q.id.length?Q.id=z=e():z=Q.id,Z.className="tiny-slider",gn.wrap(Q,Z),navigator.msMaxTouchPoints&&(Z.classList.add("ms-touch"),Z.addEventListener("scroll",q,!1));for(var n=0;n';ft&&(u+='"),u='
'+u+"
",gn.append(Z,u),st=Z.querySelector(".tiny-nav")}if(V=st.querySelectorAll("[data-slide]"),Y=V.length,!st.hasAttribute("aria-label")){st.setAttribute("aria-label","Carousel Pagination");for(var d=0;d"),lt=Z.querySelector(".tiny-controls")),X=lt.querySelector('[data-controls="prev"]'),K=lt.querySelector('[data-controls="next"]'),lt.hasAttribute("tabindex")||(lt.setAttribute("aria-label","Carousel Navigation"),X.setAttribute("aria-controls",z),K.setAttribute("aria-controls",z),X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","0"))),ft&&(st||(gn.append(Z,'
"),st=Z.querySelector(".tiny-nav")),Mt=st.querySelector("[data-action]")),A(),At&&(Q.addEventListener("touchstart",I,!1),Q.addEventListener("touchmove",H,!1),Q.addEventListener("touchend",j,!1),Q.addEventListener("touchcancel",j,!1)),ot&&(p(),X.addEventListener("click",x,!1),K.addEventListener("click",C,!1),X.addEventListener("keydown",W,!1),K.addEventListener("keydown",W,!1)),ut)for(var f=V.length;f--;)V[f].addEventListener("click",M,!1),V[f].addEventListener("keydown",O,!1);if(ft&&(T(),Mt.addEventListener("click",S,!1),ot&&(X.addEventListener("click",k,!1),K.addEventListener("click",k,!1)),ut))for(var v=0;v=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=c)for(;c>>0,e[n]=r.join(d),f())},i[N]=function(){v[x](i,t=arguments);for(var t,a={},s=0,c=[];s>>0,e[n]=r.join(d),f()},i[S]=function(e,n){return v[x](i,[e]),t!==n?n?(i[T](e),u):(i[N](e),s):o[e]?(i[N](e),s):(i[T](e),u)},function(t,e){if(e)for(var n=0;n<7;++n)e(t,M[n],{enumerable:s})}(i,a[h]),i},O=function(t,e,n){D(t[k],e,function(){var t,i=this,r=m+h+e;if(i[r])return t;if(i[r]=u,s===P){for(var a,l=O.mirror=O.mirror||o[f](w),d=l.childNodes,c=d[E],v=0;ve[E]&&(n=k[T],i=k[N],k[T]=function(){for(var t=0,e=arguments;t0&&e.right>0&&e.top0?e.cloneNode(!0):e,o=n[i],a=o.parentNode,l=o.nextSibling;r.appendChild(o),l?a.insertBefore(r,l):a.appendChild(r)}},gn.unwrap=function(t){for(var e=gn.isNodeList(t)?t:[t],n=e.length;n--;){for(var i=e[n],r=i.parentNode;i.firstChild;)r.insertBefore(i.firstChild,i);r.removeChild(i)}},Date.now||(Date.now=function(){return(new Date).getTime()}),function(){"use strict";for(var t=["webkit","moz"],e=0;e=t&&n=e&&i=e&&t_?(0===Lt?(X.disabled=!0,D(X,K)):X.disabled=!1,Lt===et-_?(K.disabled=!0,D(K,X)):K.disabled=!1):(0!==Lt&&(Lt=0,y()),X.disabled=!0,K.disabled=!0,X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","-1"),X===document.activeElement&&X.blur(),K===document.activeElement&&K.blur()))}function b(){if(st&&!t.navContainer)for(var e=Y;e--;){var n=V[e];e<$?n.hasAttribute("hidden")&&n.removeAttribute("hidden"):n.hasAttribute("hidden")||n.setAttribute("hidden","")}}function g(){if(st){var e;if(Et===-1){var n=Lt<0?Lt+et:Lt>=et?Lt-et:Lt;if(e=t.navContainer?n:Math.floor(n/_),!bt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/_);r||Lt!==et-_||(e+=1)}}else e=Et,Et=-1;for(var o=$;o--;){var a=V[o];o===e?"false"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","0"),a.setAttribute("aria-selected","true")):"true"===a.getAttribute("aria-selected")&&(a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false"))}}}function y(){var t=Q.parentNode.offsetWidth;Pt=-B*Lt,ot&&!bt&&(Pt=Math.max(Pt,-Math.abs(et*B-it-t))),a?Q.style[a]="translate3d("+Pt+"px, 0, 0)":Q.style.left=Pt+"px"}function A(){u(),m(),y(),b(),g(),h(),p(),gt&&c(),At&&F()}function w(){if(bt){var t=yt?Lt<_-U:Lt<=-U,e=yt?Lt>et+U-2*_-1:Lt>=et+U-_;ot&&U&&!yt&&(e=Lt>=et+U-_-1),t&&(Lt+=et),e&&(Lt-=et),o&&(Q.style[o]="0s"),y()}}function E(t){Q.setAttribute("aria-busy","true"),v(t),y(),setTimeout(function(){w(),h(),p(),g(),F(),gt&&c(),xt=!1,Q.setAttribute("aria-busy","false")},ft*t)}function L(t){if(!xt){t=yt?t*_:t;var e=Math.abs(t);Lt=bt?Lt+t:Math.max(0,Math.min(Lt+t,et-_)),E(e)}}function x(){L(-1)}function C(){L(1)}function M(e){if(!xt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;Et=n=Number(i.getAttribute("data-slide"));var r,o;r=t.navContainer?n:n*_,r=bt?r:Math.min(r,et-_),o=Math.abs(r-Lt),Lt=r,E(o)}}function T(){Mt=setInterval(function(){L(ht)},mt),Tt.setAttribute("data-action","stop"),Tt.innerHTML=""+pt[1],Nt=!0}function N(){clearInterval(Mt),Tt.setAttribute("data-action","start"),Tt.innerHTML=""+pt[0],Nt=!1}function S(){Nt?N():T()}function k(){Nt&&N()}function P(t){t=t||window.event,t.keyCode===l.LEFT?L(-1):t.keyCode===l.RIGHT&&L(1)}function D(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function W(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.UP&&e!==l.HOME&&e!==l.PAGEUP||n!==X&&X.disabled!==!0&&D(n,X),e!==l.RIGHT&&e!==l.DOWN&&e!==l.END&&e!==l.PAGEDOWN||n!==K&&K.disabled!==!0&&D(n,K),e!==l.ENTER&&e!==l.SPACE||(n===K?C():x())}function O(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==l.LEFT&&e!==l.PAGEUP||n.getAttribute("data-slide")>0&&D(n,n.previousElementSibling),e!==l.UP&&e!==l.HOME||0!==n.getAttribute("data-slide")&&D(n,V[0]),e!==l.RIGHT&&e!==l.PAGEDOWN||n.getAttribute("data-slide")<$-1&&D(n,n.nextElementSibling),e!==l.DOWN&&e!==l.END||n.getAttribute("data-slide")<$-1&&D(n,V[$-1]),e!==l.ENTER&&e!==l.SPACE||M(t)}function F(){if(gn.isInViewport(Q)){var t=Q.querySelectorAll('[aria-hidden="false"] .tiny-lazy');if(0!==t.length)for(var e=0,n=t.length;e=qt[qt.length-1])e=It[It.length-1];else for(var i=0;i=qt[i]&&n<=qt[i+1]&&(e=It[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),jt=function(){var e;return e=ot?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/ot):void 0!==It.length?Math.max.apply(Math,It):t.items,e?Math.min(et,e):e},Rt=function(){return ot?function(){return ot+it}:function(){return(Q.parentNode.offsetWidth+it)/_}}(),Gt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/_)}}(),zt=function(){return bt?function(){return Lt+U}:function(){return Lt}}();return _=Ht(),U=jt(),B=Rt(),$=Gt(),{init:function(){Q.classList.add("tiny-content"),0===Q.id.length?Q.id=z=e():z=Q.id,Z.className="tiny-slider",gn.wrap(Q,Z),navigator.msMaxTouchPoints&&(Z.classList.add("ms-touch"),Z.addEventListener("scroll",q,!1));for(var n=0;n';vt&&(u+='"),u='
'+u+"
",gn.append(Z,u),dt=Z.querySelector(".tiny-nav")}if(V=dt.querySelectorAll("[data-slide]"),Y=V.length,!dt.hasAttribute("aria-label")){dt.setAttribute("aria-label","Carousel Pagination");for(var d=0;d"),ut=Z.querySelector(".tiny-controls")),X=ut.querySelector('[data-controls="prev"]'),K=ut.querySelector('[data-controls="next"]'),ut.hasAttribute("tabindex")||(ut.setAttribute("aria-label","Carousel Navigation"),X.setAttribute("aria-controls",z),K.setAttribute("aria-controls",z),X.setAttribute("tabindex","-1"),K.setAttribute("tabindex","0"))),vt&&(dt||(gn.append(Z,'
"),dt=Z.querySelector(".tiny-nav")),Tt=dt.querySelector("[data-action]")),A(),wt&&(Q.addEventListener("touchstart",I,!1),Q.addEventListener("touchmove",H,!1),Q.addEventListener("touchend",j,!1),Q.addEventListener("touchcancel",j,!1)),at&&(p(),X.addEventListener("click",x,!1),K.addEventListener("click",C,!1),X.addEventListener("keydown",W,!1),K.addEventListener("keydown",W,!1)),st)for(var f=V.length;f--;)V[f].addEventListener("click",M,!1),V[f].addEventListener("keydown",O,!1);if(vt&&(T(),Tt.addEventListener("click",S,!1),at&&(X.addEventListener("click",k,!1),K.addEventListener("click",k,!1)),st))for(var v=0;v=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=t&&n=e&&i=e&&tX?(0===xt?(K.disabled=!0,W(K,Y)):K.disabled=!1,xt===et-X?(Y.disabled=!0,W(Y,K)):Y.disabled=!1):(0!==xt&&(xt=0,g()),K.disabled=!0,Y.disabled=!0,K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","-1"),K===document.activeElement&&K.blur(),Y===document.activeElement&&Y.blur()))}function p(){if(lt&&!t.navContainer)for(var e=$;e--;){var n=V[e];e=et?xt-et:xt;if(e=t.navContainer?n:Math.floor(n/X),!bt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/X);r||xt!==et-X||(e+=1)}}else e=At,At=-1;for(var a=J;a--;){var o=V[a];a===e?"false"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","0"),o.setAttribute("aria-selected","true")):"true"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","-1"),o.setAttribute("aria-selected","false"))}}}function g(){var t=Z.parentNode.offsetWidth;Nt=-U*xt,rt&&!bt&&(Nt=Math.max(Nt,-Math.abs(et*U-it-t))),o?Z.style[o]="translate3d("+Nt+"px, 0, 0)":Z.style.left=Nt+"px"}function E(){l(),h(),g(),p(),y(),m(),b(),pt&&c(),gt&&O()}function A(){if(bt){var t=yt?xtet+B-2*X-1:xt>=et+B-X;rt&&B&&!yt&&(e=xt>=et+B-X-1),t&&(xt+=et),e&&(xt-=et),a&&(Z.style[a]="0s"),g()}}function x(t){Z.setAttribute("aria-busy","true"),f(t),g(),setTimeout(function(){A(),m(),b(),y(),O(),pt&&c(),Lt=!1,Z.setAttribute("aria-busy","false")},ct*t)}function L(t){if(!Lt){t=yt?t*X:t;var e=Math.abs(t);xt=bt?xt+t:Math.max(0,Math.min(xt+t,et-X)),x(e)}}function w(){L(-1)}function M(){L(1)}function C(e){if(!Lt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;At=n=Number(i.getAttribute("data-slide"));var r,a;r=t.navContainer?n:n*X,r=bt?r:Math.min(r,et-X),a=Math.abs(r-xt),xt=r,x(a)}}function T(){Mt=setInterval(function(){L(ht)},ft),Ct.setAttribute("data-action","stop"),Ct.innerHTML=""+mt[1],Tt=!0}function k(){clearInterval(Mt),Ct.setAttribute("data-action","start"),Ct.innerHTML=""+mt[0],Tt=!1}function S(){Tt?k():T()}function N(){Tt&&k()}function P(t){t=t||window.event,t.keyCode===s.LEFT?L(-1):t.keyCode===s.RIGHT&&L(1)}function W(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function D(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.UP&&e!==s.HOME&&e!==s.PAGEUP||n!==K&&K.disabled!==!0&&W(n,K),e!==s.RIGHT&&e!==s.DOWN&&e!==s.END&&e!==s.PAGEDOWN||n!==Y&&Y.disabled!==!0&&W(n,Y),e!==s.ENTER&&e!==s.SPACE||(n===Y?M():w())}function I(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.PAGEUP||n.getAttribute("data-slide")>0&&W(n,n.previousElementSibling),e!==s.UP&&e!==s.HOME||0!==n.getAttribute("data-slide")&&W(n,V[0]),e!==s.RIGHT&&e!==s.PAGEDOWN||n.getAttribute("data-slide")=Ot[Ot.length-1])e=Ht[Ht.length-1];else for(var i=0;i=Ot[i]&&n<=Ot[i+1]&&(e=Ht[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),Gt=function(){var e;return e=rt?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/rt):void 0!==Ht.length?Math.max.apply(Math,Ht):t.items,e?Math.min(et,e):e},zt=function(){return rt?function(){return rt+it}:function(){return(Z.parentNode.offsetWidth+it)/X}}(),Rt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/X)}}(),jt=function(){return bt?function(){return xt+B}:function(){return xt}}();return X=qt(),B=Gt(),U=zt(),J=Rt(),{init:function(){Z.classList.add("tiny-content"),0===Z.id.length?Z.id=F=e():F=Z.id,_.className="tiny-slider",gn.wrap(Z,_),navigator.msMaxTouchPoints&&(_.classList.add("ms-touch"),_.addEventListener("scroll",H,!1));for(var n=0;n';vt&&(l+='"),l='
'+l+"
",gn.append(_,l),dt=_.querySelector(".tiny-nav")}if(V=dt.querySelectorAll("[data-slide]"),$=V.length,!dt.hasAttribute("aria-label")){dt.setAttribute("aria-label","Carousel Pagination");for(var u=0;u<$;u++){var c=V[u];c.setAttribute("tabindex","-1"),c.setAttribute("aria-selected","false"),c.setAttribute("aria-controls",F+"item"+u)}}}if(at&&(t.controlsContainer||(gn.append(_,'
"),st=_.querySelector(".tiny-controls")),K=st.querySelector('[data-controls="prev"]'),Y=st.querySelector('[data-controls="next"]'),st.hasAttribute("tabindex")||(st.setAttribute("aria-label","Carousel Navigation"),K.setAttribute("aria-controls",F),Y.setAttribute("aria-controls",F),K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","0"))),vt&&(dt||(gn.append(_,'
"),dt=_.querySelector(".tiny-nav")),Ct=dt.querySelector("[data-action]")),E(),Et&&(Z.addEventListener("touchstart",q,!1),Z.addEventListener("touchmove",G,!1),Z.addEventListener("touchend",z,!1),Z.addEventListener("touchcancel",z,!1)),at&&(b(),K.addEventListener("click",w,!1),Y.addEventListener("click",M,!1),K.addEventListener("keydown",D,!1),Y.addEventListener("keydown",D,!1)),lt)for(var v=V.length;v--;)V[v].addEventListener("click",C,!1),V[v].addEventListener("keydown",I,!1);if(vt&&(T(),Ct.addEventListener("click",S,!1),at&&(K.addEventListener("click",N,!1),Y.addEventListener("click",N,!1)),lt))for(var f=0;f<$;f++)V[f].addEventListener("click",N,!1);ut&&document.addEventListener("keydown",P,!1),window.addEventListener("resize",R,!1),window.addEventListener("scroll",j,!1)},destory:function(){if(Z.classList.remove("tiny-content"),Z.style.width="",Z.style[a]="",Z.style.transform="",Z.style.marginLeft="",Z.style.left="",gn.unwrap(_),bt)for(var e=B;e--;)tt[0].remove(),tt[tt.length-1].remove();if(void 0!==F){F=null,Z.removeAttribute("id");for(var n=et;n--;)tt[n].removeAttribute("id"),tt[n].removeAttribute("aria-hidden"),tt[n].style.width=""}if(Et&&(Z.removeEventListener("touchstart",q,!1),Z.removeEventListener("touchmove",G,!1),Z.removeEventListener("touchend",z,!1),Z.removeEventListener("touchcancel",z,!1)),at&&(t.controlsContainer?(st.removeAttribute("aria-label"),K.removeAttribute("aria-controls"),K.removeAttribute("tabindex"),K.removeEventListener("click",w,!1),K.removeEventListener("keydown",D,!1),Y.removeAttribute("aria-controls"),Y.removeAttribute("tabindex"),Y.removeEventListener("click",M,!1),Y.removeEventListener("keydown",D,!1)):(st.remove(),st=null,K=null,Y=null)),lt){if(t.navContainer){dt.removeAttribute("aria-label");for(var i=V.length;i--;)V[i].removeAttribute("aria-selected"),V[i].removeAttribute("aria-controls"),V[i].removeEventListener("click",C,!1),V[i].removeEventListener("keydown",I,!1)}else dt.remove(),dt=null;V=null,$=null}if(vt)if(t.navContainer||null===dt){if(Ct.removeEventListener("click",S,!1),Ct=null,at&&t.controlsContainer&&(K.removeEventListener("click",N,!1),Y.removeEventListener("click",N,!1)),lt&&t.navContainer)for(var r=0;r<$;r++)V[r].removeEventListener("click",N,!1)}else dt.remove(),dt=null;ut&&document.removeEventListener("keydown",ut,!1),window.removeEventListener("resize",R,!1),window.removeEventListener("scroll",j,!1)}}}function e(){return void 0===window.tinySliderNumber?window.tinySliderNumber=1:window.tinySliderNumber++,"tinySlider"+window.tinySliderNumber}function n(t){return t*(180/Math.PI)}function i(t,e){return Math.abs(90-Math.abs(t))>=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i=t&&n=e&&i=e&&tX?(0===xt?(K.disabled=!0,W(K,Y)):K.disabled=!1,xt===et-X?(Y.disabled=!0,W(Y,K)):Y.disabled=!1):(0!==xt&&(xt=0,g()),K.disabled=!0,Y.disabled=!0,K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","-1"),K===document.activeElement&&K.blur(),Y===document.activeElement&&Y.blur()))}function p(){if(dt&&!t.navContainer)for(var e=$;e--;){var n=V[e];e=et?xt-et:xt;if(e=t.navContainer?n:Math.floor(n/X),!pt&&!t.navContainer){var i=/^-?[0-9]+$/,r=i.test(et/X);r||xt!==et-X||(e+=1)}}else e=Lt,Lt=-1;for(var a=J;a--;){var o=V[a];a===e?"false"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","0"),o.setAttribute("aria-selected","true")):"true"===o.getAttribute("aria-selected")&&(o.setAttribute("tabindex","-1"),o.setAttribute("aria-selected","false"))}}}function g(){var t=Z.parentNode.offsetWidth;Pt=-U*xt,at&&!pt&&(Pt=Math.max(Pt,-Math.abs(et*U-it-t))),o?Z.style[o]="translate3d("+Pt+"px, 0, 0)":Z.style.left=Pt+"px"}function E(){l(),h(),g(),p(),y(),m(),b(),yt&&c(),Et&&O()}function A(){if(pt){var t=gt?xtet+B-2*X-1:xt>=et+B-X;at&&B&&!gt&&(e=xt>=et+B-X-1),t&&(xt+=et),e&&(xt-=et),a&&(Z.style[a]="0s"),g()}}function L(t){Z.setAttribute("aria-busy","true"),f(t),g(),setTimeout(function(){A(),m(),b(),y(),O(),yt&&c(),wt=!1,Z.setAttribute("aria-busy","false")},vt*t)}function x(t){if(!wt){t=gt?t*X:t;var e=Math.abs(t);xt=pt?xt+t:Math.max(0,Math.min(xt+t,et-X)),L(e)}}function w(){x(-1)}function M(){x(1)}function C(e){if(!wt){for(var n,i=e.target||e.srcElement;gn.indexOf(V,i)===-1;)i=i.parentNode;Lt=n=Number(i.getAttribute("data-slide"));var r,a;r=t.navContainer?n:n*X,r=pt?r:Math.min(r,et-X),a=Math.abs(r-xt),xt=r,L(a)}}function T(){Ct=setInterval(function(){x(mt)},ht),Tt.setAttribute("data-action","stop"),Tt.innerHTML=""+bt[1],kt=!0}function k(){clearInterval(Ct),Tt.setAttribute("data-action","start"),Tt.innerHTML=""+bt[0],kt=!1}function S(){kt?k():T()}function N(){kt&&k()}function P(t){t=t||window.event,t.keyCode===s.LEFT?x(-1):t.keyCode===s.RIGHT&&x(1)}function W(t,e){"object"==typeof t&&"object"==typeof e&&t===document.activeElement&&(t.blur(),e.focus())}function D(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.UP&&e!==s.HOME&&e!==s.PAGEUP||n!==K&&K.disabled!==!0&&W(n,K),e!==s.RIGHT&&e!==s.DOWN&&e!==s.END&&e!==s.PAGEDOWN||n!==Y&&Y.disabled!==!0&&W(n,Y),e!==s.ENTER&&e!==s.SPACE||(n===Y?M():w())}function I(t){t=t||window.event;var e=t.keyCode,n=document.activeElement;e!==s.LEFT&&e!==s.PAGEUP||n.getAttribute("data-slide")>0&&W(n,n.previousElementSibling),e!==s.UP&&e!==s.HOME||0!==n.getAttribute("data-slide")&&W(n,V[0]),e!==s.RIGHT&&e!==s.PAGEDOWN||n.getAttribute("data-slide")=Ht[Ht.length-1])e=qt[qt.length-1];else for(var i=0;i=Ht[i]&&n<=Ht[i+1]&&(e=qt[i]);else e=t.items;return Math.max(Math.min(et,e),1)}}(),zt=function(){var e;return e=at?!!t.maxContainerWidth&&Math.ceil(t.maxContainerWidth/at):void 0!==qt.length?Math.max.apply(Math,qt):t.items,e?Math.min(et,e):e},Rt=function(){return at?function(){return at+it}:function(){return(Z.parentNode.offsetWidth+it)/X}}(),jt=function(){return t.navContainer?function(){return et}:function(){return Math.ceil(et/X)}}(),Ft=function(){return pt?function(){return xt+B}:function(){return xt}}();return X=Gt(),B=zt(),U=Rt(),J=jt(),{init:function(){Z.classList.add("tiny-content"),0===Z.id.length?Z.id=F=e():F=Z.id,_.className="tiny-slider",gn.wrap(Z,_),navigator.msMaxTouchPoints&&(_.classList.add("ms-touch"),_.addEventListener("scroll",H,!1));for(var n=0;n';ft&&(l+='"),l='
'+l+"
",gn.append(_,l),ut=_.querySelector(".tiny-nav")}if(V=ut.querySelectorAll("[data-slide]"),$=V.length,!ut.hasAttribute("aria-label")){ut.setAttribute("aria-label","Carousel Pagination");for(var u=0;u<$;u++){var c=V[u];c.setAttribute("tabindex","-1"),c.setAttribute("aria-selected","false"),c.setAttribute("aria-controls",F+"item"+u)}}}if(ot&&(t.controlsContainer||(gn.append(_,'
"),lt=_.querySelector(".tiny-controls")),K=lt.querySelector('[data-controls="prev"]'),Y=lt.querySelector('[data-controls="next"]'),lt.hasAttribute("tabindex")||(lt.setAttribute("aria-label","Carousel Navigation"),K.setAttribute("aria-controls",F),Y.setAttribute("aria-controls",F),K.setAttribute("tabindex","-1"),Y.setAttribute("tabindex","0"))),ft&&(ut||(gn.append(_,'
"),ut=_.querySelector(".tiny-nav")),Tt=ut.querySelector("[data-action]")),E(),At&&(Z.addEventListener("touchstart",q,!1),Z.addEventListener("touchmove",G,!1),Z.addEventListener("touchend",z,!1),Z.addEventListener("touchcancel",z,!1)),ot&&(b(),K.addEventListener("click",w,!1),Y.addEventListener("click",M,!1),K.addEventListener("keydown",D,!1),Y.addEventListener("keydown",D,!1)),dt)for(var v=V.length;v--;)V[v].addEventListener("click",C,!1),V[v].addEventListener("keydown",I,!1);if(ft&&(T(),Tt.addEventListener("click",S,!1),ot&&(K.addEventListener("click",N,!1),Y.addEventListener("click",N,!1)),dt))for(var f=0;f<$;f++)V[f].addEventListener("click",N,!1);ct&&document.addEventListener("keydown",P,!1),window.addEventListener("resize",R,!1),window.addEventListener("scroll",j,!1)},destory:function(){if(Z.classList.remove("tiny-content"),Z.style.width="",Z.style[a]="",Z.style.transform="",Z.style.marginLeft="",Z.style.left="",gn.unwrap(_),pt)for(var e=B;e--;)tt[0].remove(),tt[tt.length-1].remove();if(void 0!==F){F=null,Z.removeAttribute("id");for(var n=et;n--;)tt[n].removeAttribute("id"),tt[n].removeAttribute("aria-hidden"),tt[n].style.width=""}if(At&&(Z.removeEventListener("touchstart",q,!1),Z.removeEventListener("touchmove",G,!1),Z.removeEventListener("touchend",z,!1),Z.removeEventListener("touchcancel",z,!1)),ot&&(t.controlsContainer?(lt.removeAttribute("aria-label"),K.removeAttribute("aria-controls"),K.removeAttribute("tabindex"),K.removeEventListener("click",w,!1),K.removeEventListener("keydown",D,!1),Y.removeAttribute("aria-controls"),Y.removeAttribute("tabindex"),Y.removeEventListener("click",M,!1),Y.removeEventListener("keydown",D,!1)):(lt.remove(),lt=null,K=null,Y=null)),dt){if(t.navContainer){ut.removeAttribute("aria-label");for(var i=V.length;i--;)V[i].removeAttribute("aria-selected"),V[i].removeAttribute("aria-controls"),V[i].removeEventListener("click",C,!1),V[i].removeEventListener("keydown",I,!1)}else ut.remove(),ut=null;V=null,$=null}if(ft)if(t.navContainer||null===ut){if(Tt.removeEventListener("click",S,!1),Tt=null,ot&&t.controlsContainer&&(K.removeEventListener("click",N,!1),Y.removeEventListener("click",N,!1)),dt&&t.navContainer)for(var r=0;r<$;r++)V[r].removeEventListener("click",N,!1)}else ut.remove(),ut=null;ct&&document.removeEventListener("keydown",ct,!1),window.removeEventListener("resize",R,!1),window.removeEventListener("scroll",j,!1)}}}function e(){return void 0===window.tinySliderNumber?window.tinySliderNumber=1:window.tinySliderNumber++,"tinySlider"+window.tinySliderNumber}function n(t){return t*(180/Math.PI)}function i(t,e){return Math.abs(90-Math.abs(t))>=90-e?"horizontal":Math.abs(90-Math.abs(t))<=e&&"vertical"}function r(t){if("object"==typeof t){for(var e=[],n=Object.keys(t),i=0,r=n.length;i