/** * jquery.hoverdir.js v1.1.2 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2012, Codrops * http://www.codrops.com */ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){"use strict";function e(e,i){this.$el=t(e),this.options=t.extend(!0,{},this.defaults,i),this.isVisible=!1,this.$hoverElem=this.$el.find(this.options.hoverElem),this.transitionProp="all "+this.options.speed+"ms "+this.options.easing,this.support=this._supportsTransitions(),this._loadEvents()}e.prototype={defaults:{speed:300,easing:"ease",hoverDelay:0,inverse:!1,hoverElem:"div"},constructor:e,_supportsTransitions:function(){if("undefined"!=typeof Modernizr)return Modernizr.csstransitions;var t=(document.body||document.documentElement).style,e="transition";if("string"==typeof t[e])return!0;var i=["Moz","webkit","Webkit","Khtml","O","ms"];e=e.charAt(0).toUpperCase()+e.substr(1);for(var s=0;si?i/e:1),o=(t.y-this.$el.offset().top-i/2)*(i>e?e/i:1);return Math.round((Math.atan2(o,s)*(180/Math.PI)+180)/90+3)%4},_getStyle:function(t){var e,i,s={left:"0",top:"-100%"},o={left:"0",top:"100%"},r={left:"-100%",top:"0"},n={left:"100%",top:"0"},h={top:"0"},a={left:"0"};switch(t){case 0:case"top":e=this.options.inverse?o:s,i=h;break;case 1:case"right":e=this.options.inverse?r:n,i=a;break;case 2:case"bottom":e=this.options.inverse?s:o,i=h;break;case 3:case"left":e=this.options.inverse?n:r,i=a}return{from:e,to:i}},_applyAnimation:function(e){t.fn.applyStyle=this.support?t.fn.css:t.fn.animate,this.$hoverElem.stop().applyStyle(e,t.extend(!0,[],{duration:this.options.speed}))},show:function(t){this.$el.off("mouseenter.hoverdir mouseleave.hoverdir"),this.isVisible||(this.direction=t||"top",this._showHover())},hide:function(t){this.rebuild(),this.isVisible&&(this.direction=t||"bottom",this._hideHover())},setOptions:function(e){this.options=t.extend(!0,{},this.defaults,this.options,e)},destroy:function(){this.$el.off("mouseenter.hoverdir mouseleave.hoverdir"),this.$el.data("hoverdir",null)},rebuild:function(t){"object"==typeof t&&this.setOptions(t),this._loadEvents()}},t.fn.hoverdir=function(i,s){return this.each(function(){var o=t(this).data("hoverdir"),r="object"==typeof i&&i;o||(o=new e(this,r),t(this).data("hoverdir",o)),"string"==typeof i&&(o[i](s),"destroy"===i&&t(this).data("hoverdir",!1))})},t.fn.hoverdir.Constructor=e});