"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function i(e,n){for(var t=0;t
',this.DOM.el.appendChild(this.DOM.reveal),this.DOM.revealInner=this.DOM.reveal.querySelector(".hover-reveal__inner"),this.DOM.revealInner.style.overflow="hidden",this.DOM.revealImg=this.DOM.revealInner.querySelector(".hover-reveal__img"),this.initEvents()}return _createClass(n,[{key:"initEvents",value:function(){var o=this;this.positionElement=function(e){var n,t,i,a=(i=t=0,(n=e)||(n=window.event),n.pageX||n.pageY?(t=n.pageX,i=n.pageY):(n.clientX||n.clientY)&&(t=n.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i=n.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:t,y:i}),s=document.body.scrollLeft+document.documentElement.scrollLeft,l=document.body.scrollTop+document.documentElement.scrollTop;o.DOM.reveal.style.top=a.y-20-l+"px",o.DOM.reveal.style.left=a.x+20-s+"px"},this.mouseenterFn=function(e){o.positionElement(e);var n=o;setTimeout(function(){n.showImage()},300)},this.mousemoveFn=function(e){return requestAnimationFrame(function(){o.positionElement(e)})},this.mouseleaveFn=function(){o.hideImage()},this.DOM.el.addEventListener("mouseenter",this.mouseenterFn),this.DOM.el.addEventListener("mousemove",this.mousemoveFn),this.DOM.el.addEventListener("mouseleave",this.mouseleaveFn)}},{key:"showImage",value:function(){var e=this;TweenMax.killTweensOf(this.DOM.revealInner),TweenMax.killTweensOf(this.DOM.revealImg),this.tl=new TimelineMax({onStart:function(){e.DOM.reveal.style.opacity=1,TweenMax.set(e.DOM.el,{zIndex:9999})}}).add("begin").add(new TweenMax(this.DOM.revealInner,.3,{ease:Sine.easeOut,startAt:{x:"-100%"},x:"0%"}),"begin").add(new TweenMax(this.DOM.revealImg,.3,{ease:Sine.easeOut,startAt:{x:"100%"},x:"0%"}),"begin");var n=this.DOM.reveal;setTimeout(function(){n.classList.add("showed")},200)}},{key:"hideImage",value:function(){var e=this;this.DOM.reveal.classList.remove("showed"),TweenMax.killTweensOf(this.DOM.revealInner),TweenMax.killTweensOf(this.DOM.revealImg),this.tl=new TimelineMax({onStart:function(){TweenMax.set(e.DOM.el,{zIndex:9999})},onComplete:function(){TweenMax.set(e.DOM.el,{zIndex:""}),TweenMax.set(e.DOM.reveal,{opacity:0})}}).add("begin").add(new TweenMax(this.DOM.revealInner,.3,{ease:Sine.easeOut,x:"100%"}),"begin").add(new TweenMax(this.DOM.revealImg,.3,{ease:Sine.easeOut,x:"-100%"}),"begin")}}]),n}();n(".menu-item a.has-hover-img").on({mouseenter:function(){new e(n(this)[0])},mouseleave:function(){if(n(this).find(".hover-reveal")){var e=n(this);setTimeout(function(){e.find(".hover-reveal").remove()},350)}}})});