-
Notifications
You must be signed in to change notification settings - Fork 11
/
angular-menu-slideout.min.js
1 lines (1 loc) · 1.12 KB
/
angular-menu-slideout.min.js
1
angular.module("MenuSlideout",["ngTouch"]).directive("menuSlideout",["$swipe","$document","$rootScope",function(e,t,n){return{restrict:"A",link:function(t,r,i){var s,o,u,a,f=10,l=!1,c=100,h=30,p="menu-slideout-transition",d="menu-slideout-open",v="menu-slideout-is-sliding",m=230,g=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||e.OLink===""&&["","o"])[1];return"-"+t+"-"}();e.bind(r,{start:function(e,t){l=!1;s=angular.copy(a=e)},end:function(e,t){u=e;r.removeAttr("style").addClass(p).removeClass(v);if(!l)return;e.x-s.x>c&&(o="right");e.x-s.x<-1*c&&(o="left");o=="right"?r.addClass(d):r.removeClass(d);n.$broadcast("slideMenuToggled",o=="right")},move:function(e,t){if(!l&&Math.abs(s.x-e.x)<f)return;o=a.x<e.x?"right":"left";r.removeClass(p).addClass(v);var n=e.x-s.x+(r.hasClass(d)?m:0);n=Math.max(0,Math.min(m,n));var i={};i[g+"transform"]="translate3d("+n+"px, 0, 0)";r.css(i);a=e;l=!0},cancel:function(e,t){r.addClass(p).removeClass(v);r.removeAttr("style")}},{moveYBufferRadius:h});n.$on("toggleSlideMenu",function(e,t){r.toggleClass(d,t)})}}}]);