From ac4defb6035779f20996ce5a3a7f7b45b32ab8c8 Mon Sep 17 00:00:00 2001 From: borsch Date: Mon, 13 Feb 2017 09:26:32 +0200 Subject: [PATCH] version 1.0.0 --- dist/carousel.min.css | 1 + dist/carousel.min.js | 1 + 2 files changed, 2 insertions(+) create mode 100644 dist/carousel.min.css create mode 100644 dist/carousel.min.js diff --git a/dist/carousel.min.css b/dist/carousel.min.css new file mode 100644 index 0000000..a97c1aa --- /dev/null +++ b/dist/carousel.min.css @@ -0,0 +1 @@ +body{margin:0;padding:0}.carousel-main-container{width:100%;height:90vh}.carousel-container{width:100%;height:100%;margin:0;padding:0;top:0;left:0;bottom:0;position:absolute;z-index:1} \ No newline at end of file diff --git a/dist/carousel.min.js b/dist/carousel.min.js new file mode 100644 index 0000000..58766b0 --- /dev/null +++ b/dist/carousel.min.js @@ -0,0 +1 @@ +!function(e){function n(e){return 1-Math.cos(e)}function t(){document.documentElement.style.overflow="hidden",document.body.scroll="no"}function i(e){switch(e){case"up":return"down";case"down":return"up";case"left":return"right";case"right":return"left";default:return null}}function o(){if(sessionStorage.desktop)return!1;if(localStorage.mobile)return!0;for(var e=["iphone","ipad","android","blackberry","nokia","opera mini","windows mobile","windows phone","iemobile"],n=navigator.userAgent.toLowerCase(),t=0;t0)return!0;return!1}const s=".carousel-container",r=100,a=400;var c=window.innerWidth,l=window.innerHeight;e.CarouselInit=function(e,n){var t=new f(e);new u(t,n)};var u=function(e,n){return this._containers=e.find(s),this._options=n||{},o()?void this.mobileInit():(this.init(),void this.addListeners())};u.prototype.mobileInit=function(){var e=this._containers;console.error("Not support mobile phones in current version"),e.show(),e.removeClass("carousel-container")},u.prototype.init=function(){t();var e=this._containers,i=this._options,o=this._options.directions=i.directions||[];this._current=0,this._easing=i.easing&&"function"==typeof i.easing?i.easing:n;var s=parseInt(i.time);this._animationTime=s>0?s:a,this._frames=this._animationTime/r,e.hide().get(0).show();var c=e.size();if(o.lengthl;++l)o.push("down")},u.prototype.addListeners=function(){function e(){var e=0;return function(t){if(!n._animationInProcess){var i=t.deltaY||t.detail||t.wheelDelta;i+e>e?(n._play(!0),e+=i):(n._play(!1),e+=i)}}}var n=this;n._animationInProcess=!1,window.onresize=function(){c=window.innerWidth,l=window.innerHeight},window.addEventListener?(window.addEventListener("mousewheel",e(),!1),window.addEventListener("DOMMouseScroll",e(),!1)):window.attachEvent("onmousewheel",e()),window.onkeydown=function(e){if(!n._animationInProcess){var t=e.keyCode;40==t?n._play(!0):38==t&&n._play(!1)}}},u.prototype._play=function(e){var n=this,t=n._current,o=n._containers,s=n._options.directions,r=null;if(r=e?t+10?t-1:null,null!=r){var a;if(t>r){var c=i(s[r]);a=p[c]?c:"down"}else a=p[s[t]]?s[t]:"up";n._animationInProcess=!0;var l=o.get(t),u=o.get(r);n._current=r,this["_"+a](l,u)}else n._animationInProcess=!1},u.prototype._right=function(e,n){n["default"]().css("left",-c+"px"),e["default"]();var t=(new Date).getTime(),i=this,o=i._easing,s=i._frames,r=i._animationTime,a=setInterval(function(){var s=((new Date).getTime()-t)/r,l=o(s),u=l*c,f=u-c;n.css("left",f+"px"),e.css("left",u+"px"),l>.99&&(n.css("left","0px"),e.css("left",c+"px"),clearInterval(a),i._animationInProcess=!1,e.hide())},s)},u.prototype._left=function(e,n){n["default"]().css("left",c+"px"),e["default"]();var t=(new Date).getTime(),i=this,o=i._easing,s=i._frames,r=i._animationTime,a=setInterval(function(){var s=((new Date).getTime()-t)/r,l=o(s),u=-c*l,f=u+c;n.css("left",f+"px"),e.css("left",u+"px"),l>.99&&(e.css("left",-c+"px"),n.css("left","0px"),clearInterval(a),i._animationInProcess=!1,e.hide())},s)},u.prototype._down=function(e,n){n["default"]().css("top",l+"px"),e["default"]();var t=(new Date).getTime(),i=this,o=i._easing,s=i._frames,r=i._animationTime,a=setInterval(function(){var s=((new Date).getTime()-t)/r,c=o(s),u=-l*c,f=u+l;n.css("top",f+"px"),e.css("top",u+"px"),c>.99&&(e.css("top",-l+"px"),n.css("top","0px"),clearInterval(a),i._animationInProcess=!1,e.hide())},s)},u.prototype._up=function(e,n){n["default"]().css("top",-l+"px"),e["default"]();var t=(new Date).getTime(),i=this,o=i._easing,s=i._frames,r=i._animationTime,a=setInterval(function(){var s=((new Date).getTime()-t)/r,c=o(s),u=l*c,f=u-l;n.css("top",f+"px"),e.css("top",u+"px"),c>.99&&(e.css("top",-l+"px"),n.css("top","0px"),clearInterval(a),i._animationInProcess=!1,e.hide())},s)};var f=function(e){var n;return e.constructor===String?n=document.querySelectorAll(e):e.constructor===Array&&(n=e),{css:function(e,t){for(var i=0;i