1/* 2 * jquery sliphover 1.1.7 3 * apply 2d/3d hover animation to images 4 * 5 * inspired by http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/index2.html 6 * and http://codepen.io/taufnrsyd/pen/ufcdG 7 * 8 * Author:Wayou 9 * 10 * Licensed under the MIT license. 11 * 12 * Bug reporting, suggestion, feature requirments, you can: 13 * mail to [email protected] 14 * or visit the project on github https://github.com/Wayou/SlipHover to open issues 15 */ 16;(function($,window,document,undefined){'use strict';var V=function(bn,options){this.v=bn,this.options=$.extend({},this.defaults,options)};V.prototype={defaults:{target:'img.slip',title:'alt',duration:300,fontColor:'#ffffff',backgroundColor:'rgba(0,0,0,.6)',reverse:false,flip:false,autoScroll:true,scrollSpeed:40,height:'100%'},aV:{l:{'left':'0','bottom':'0'},bE:{'left':'0','bottom':'100%'},bD:{'left':'100%','bottom':'0'},aD:{'left':'0','bottom':'-100%'},aW:{'left':'-100%','bottom':'0'}},O:{bK:{'perspective-origin':'50% 0%','-webkit-perspective-origin':'50% 0%'},bG:{'perspective-origin':'100% 50%','-webkit-perspective-origin':'100% 50%'},ae:{'perspective-origin':'50% 100%','-webkit-perspective-origin':'50% 100%'},an:{'perspective-origin':'0% 50%','-webkit-perspective-origin':'0% 50%'}},ah:'@-webkit-keyframes topenter{ from{ -webkit-transform-origin:top; -webkit-transform:rotateX(-90deg); } to{ -webkit-transform-origin:top; -webkit-transform:rotateX(0deg); } } @keyframes topenter{ from{ transform-origin:top; transform:rotateX(-90deg); } to{ transform-origin:top; transform:rotateX(0deg); } } @-webkit-keyframes topleave{ from{ -webkit-transform-origin:top; -webkit-transform:rotateX(0deg); } to{ -webkit-transform-origin:top; -webkit-transform:rotateX(-90deg); } } @keyframes topleave{ from{ transform-origin:top; transform:rotateX(0deg); } to{ transform-origin:top; transform:rotateX(-90deg); } } @-webkit-keyframes rightenter{ from{ -webkit-transform-origin:right; -webkit-transform:rotateY(-90deg); } to{ -webkit-transform-origin:right; -webkit-transform:rotateY(0deg); } } @keyframes rightenter{ from{ transform-origin:right; transform:rotateY(-90deg); } to{ transform-origin:right; transform:rotateY(0deg); } } @-webkit-keyframes rightleave{ from{ -webkit-transform-origin:right; -webkit-transform:rotateY(0deg); } to{ -webkit-transform-origin:right; -webkit-transform:rotateY(-90deg); } } @keyframes rightleave{ from{ transform-origin:right; transform:rotateY(0deg); } to{ transform-origin:right; transform:rotateY(-90deg); } } @-webkit-keyframes bottomenter{ from{ -webkit-transform-origin:bottom; -webkit-transform:rotateX(90deg); } to{ -webkit-transform-origin:bottom; -webkit-transform:rotateX(0deg); } } @keyframes bottomenter{ from{ transform-origin:bottom; transform:rotateX(90deg); } to{ transform-origin:bottom; transform:rotateX(0deg); } } @-webkit-keyframes bottomleave{ from{ -webkit-transform-origin:bottom; -webkit-transform:rotateX(0deg); } to{ -webkit-transform-origin:bottom; -webkit-transform:rotateX(90deg); } } @keyframes bottomleave{ from{ transform-origin:bottom; transform:rotateX(0deg); } to{ transform-origin:bottom; transform:rotateX(90deg); } } @-webkit-keyframes leftenter{ from{ -webkit-transform-origin:left; -webkit-transform:rotateY(90deg); } to{ -webkit-transform-origin:left; -webkit-transform:rotateY(0deg); } } @keyframes leftenter{ from{ transform-origin:left; transform:rotateY(90deg); } to{ transform-origin:left; transform:rotateY(0deg); } } @-webkit-keyframes leftleave{ from{ -webkit-transform-origin:left; -webkit-transform:rotateY(0deg); } to{ -webkit-transform-origin:left; -webkit-transform:rotateY(90deg); } } @keyframes leftleave{ from{ transform-origin:left; transform:rotateY(0deg); } to{ transform-origin:left; transform:rotateY(90deg); } }',bN:function(bn,options){var C=this,v=bn||this.v,options=options||this.options,aX=v.find(options.target).size()>0?v.find(options.target):v;if(this.options.flip){var bu=$('style').length===0?$('<style>'):$('style').first();bu.append(this.ah).appendTo('head');};aX.each(function(){var T=C.al($(this)),j=C.bc(T,options,$(this)),G=j.children(),F=G.height(),ax=j.height();C.aZ(T,j,options);
16if(C.options.autoScroll&&F-ax>0){j.css('overflow','hidden');var scrollTop={top: -(F-ax)},ad={top:0},J=(F-ax)*C.options.scrollSpeed;j.hover(function(){C.aQ(G,scrollTop,ad,J);},function(){j.children().stop().css('top','0');})};});return v;},aQ:function(v,az,av,J){var C=this;v.animate(az,J,'linear',function(){v.animate(av,J,'linear',function(){C.aQ(v,az,av,J);});});},al:function(R){var aR=R.parents().filter(function(){return this.style.position!=='static';}).length,aL=aR?R.position():R.offset(),as=R.outerWidth(),bg=R.outerHeight(),borderWidth=(R.outerWidth()-R.innerWidth())/2,aP=aL.top,bI=aL.left,T=$('<div class="sliphoveritem" style="border-radius:'+R.css('borderRadius')+';width:'+as+'px;height:'+bg+'px;text-align:center;overflow:hidden;position:absolute;top:'+aP+'px;left:'+bI+'px;">').insertBefore(R);if(this.options.flip){T.css({'perspective':'500px','-webkit-perspective':'500px','perspective-origin':'0% 50%','-webkit-perspective-origin':'0% 50%'});};var browser=this.bx();if(browser.k&&browser.version<=10){T.css('background-color','rgba(255,255,255,0.1)');};return T;},bc:function(T,options,R){var j=$('<div class="sliphoveritemTitle" style="border-radius:'+R.css('borderRadius')+';width:100%;height:'+this.options.height+';box-sizing:border-box;-moz-box-sizing:border-box;padding:35px;overflow:auto;position:absolute;color:'+this.options.fontColor+';background-color:'+this.options.backgroundColor+';">').html('<div style="position:relative;width:100%;">'+R.attr(options.title)+'</div>'),G=j.children();if(this.options.flip){j.css({'left':'0','bottom':'0','transform-origin':'left','transform':'rotateY(90deg)','-webkit-transform-origin':'left','-webkit-transform':'rotateY(90deg)','backface-visibility':'hidden','-webkit-backface-visibility':'hidden'});}else{j.css(this.aV.aW);};T.html(j);if(G.height()<j.height()){G.css({'width':G.width(),'height':j.height(),'display':'block','text-align':'left'});};return j;},H:function(bV,bM,T,j){var duration=this.options.duration;switch(duration){case 'fast':duration='200ms';break;case 'slow':duration='600ms';break;default:duration=duration+'ms';break;};T.css(bV);j.css({'animation':bM+' '+duration+' forwards','-webkit-animation':bM+' '+duration+' forwards'});},aO:function(R,event){var w=R.width(),K=R.height(),x=(event.pageX-R.offset().left-(w/2))*(w>K?(K/w):1),y=(event.pageY-R.offset().top-(K/2))*(K>w?(w/K):1),direction=Math.round((((Math.atan2(y,x)*(180/Math.PI))+180)/90)+3)%4;return direction;},aZ:function(R,j,options){var C=this;R.unbind('mouseenter.sliphover mouseleave.sliphover').bind('mouseenter.sliphover mouseleave.sliphover',function(e){var t=e.type,direction=C.aO(R,e);C.bi(t,direction,R,j,options,C.aV);});},bi:function(t,direction,T,j,options,L){if(options.reverse){direction=(direction+2)%4};switch(direction){case 0:if(t=='mouseenter'){if(options.flip){this.H(this.O.bK,'topenter',T,j);}else{j.css(L.bE);j.stop().animate(L.l,options.duration);};}else{if(options.flip){this.H(this.O.bK,'topleave',T,j);}else{j.stop().animate(L.bE,options.duration);};}break;case 1:if(t=='mouseenter'){if(options.flip){this.H(this.O.bG,'rightenter',T,j);}else{j.css(L.bD);j.stop().animate(L.l,options.duration);};}else{if(options.flip){this.H(this.O.bG,'rightleave',T,j);}else{j.stop().animate(L.bD,options.duration);};}break;case 2:if(t=='mouseenter'){if(options.flip){this.H(this.O.ae,'bottomenter',T,j);}else{j.css(L.aD);j.stop().animate(L.l,options.duration);};}else{if(options.flip){this.H(this.O.ae,'bottomleave',T,j);}else{j.stop().animate(L.aD,options.duration);};}break;case 3:if(t=='mouseenter'){if(options.flip){this.H(this.O.an,'leftenter',T,j);}else{j.css(L.aW);j.stop().animate(L.l,options.duration);};}else{if(options.flip){this.H(this.O.an,'leftleave',T,j);}else{j.stop().animate(L.aW,options.duration);};}break;default:throw new Error('failed to get the direction.');}},bx:function(){var version=999,k=false;if(navigator.appVersion.indexOf("MSIE")!= -1){k=true;version=parseFloat(navigator.appVersion.split("MSIE")[1]);}return{k:k,version:version};}};V.constructor=V;$.fn.sliphover=function(options){var entry=this.data('sliphover');if(!entry){entry=new V(this,options);entry.bN();this.data('sliphover',entry);}else{entry.bN(this,options);}$(window).unbind('resize.sliphover').bind('resize.sliphover',function(){$('.
16sliphoveritem').remove();entry.bN();});return entry;};}(jQuery,window,document)); 17 18 19if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 20 $('body').addClass('touch') 21 } 22 23 24jQuery(window).bind("load", function(){ 25jQuery('.sliphover-active #container').not('.touch #container').sliphover(); 26});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.