jquery.hoverex.js
6.28 KB
var a={fn:{moveZoom:function(b,c){var d=b.height(),e=b.width(),f=c.pageY-b.offset().top,g=c.pageX-b.offset().left;var h=b.find("\x69\x6d\x67");var i=b.data("\x7a\x6f\x6f\x6d");if(i&&i!="\x61\x75\x74\x6f"){var j=parseFloat(i);h.css({"\x77\x69\x64\x74\x68":e*j+"\x70\x78","\x68\x65\x69\x67\x68\x74":d*j+"\x70\x78","\x74\x6f\x70":-f*(j-0x1)+"\x70\x78","\x6c\x65\x66\x74":-g*(j-0x1)+"\x70\x78"})}else{var j=h.width()/e;h.css({"\x74\x6f\x70":-f*(j-0x1)+"\x70\x78","\x6c\x65\x66\x74":-g*(j-0x1)+"\x70\x78"})}},changeZoom:function(b,c,d,e,f){var g=b.find("\x69\x6d\x67");var h=b.data("\x7a\x6f\x6f\x6d");h=h=="\x61\x75\x74\x6f"?g.width()/b.width():parseFloat(h);var i=b.data("\x7a\x6f\x6f\x6d\x73\x74\x65\x70");i=i?parseFloat(i):0.5;var j=b.data("\x7a\x6f\x6f\x6d\x72\x61\x6e\x67\x65");j=j?j.split("\x2c"):"\x31\x2c\x34";var k=parseFloat(j[0x0]),l=parseFloat(j[0x1])>h?parseFloat(j[0x1]):h;var m=f>0x0?0x1:-0x1;var n=Math.round((h+i*m)*0xa)/10.0;if(n>=k&&n<=l){b.data("\x7a\x6f\x6f\x6d",n);a.fn.showZoomState(b,n);a.fn.moveZoom(b,c)}},showZoomState:function(b,c){var d=b.find("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d\x73\x74\x61\x74\x65");if(d.length==0x0){d=$('\x3c\x73\x70\x61\x6e\x20\x63\x6c\x61\x73\x73\x3d\x22\x68\x65\x2d\x7a\x6f\x6f\x6d\x73\x74\x61\x74\x65\x22\x3e'+c+'\x58\x3c\x2f\x73\x70\x61\x6e\x3e').appendTo(b)};d.text(c+"\x58").stop(true,true).fadeIn(0x12c).delay(0xc8).fadeOut(0x12c)},switchImg:function(b,c){var d=b.data("\x61\x6e\x69\x6d\x61\x74\x65");d=d?animation:"\x72\x61\x6e\x64\x6f\x6d";if(d=="\x72\x61\x6e\x64\x6f\x6d"){var f=["\x66\x61\x64\x65\x49\x6e","\x66\x61\x64\x65\x49\x6e\x4c\x65\x66\x74","\x66\x61\x64\x65\x49\x6e\x52\x69\x67\x68\x74","\x66\x61\x64\x65\x49\x6e\x55\x70","\x66\x61\x64\x65\x49\x6e\x44\x6f\x77\x6e","\x72\x6f\x74\x61\x74\x65\x49\x6e","\x72\x6f\x74\x61\x74\x65\x49\x6e\x4c\x65\x66\x74","\x72\x6f\x74\x61\x74\x65\x49\x6e\x52\x69\x67\x68\x74","\x72\x6f\x74\x61\x74\x65\x49\x6e\x55\x70","\x72\x6f\x74\x61\x74\x65\x49\x6e\x44\x6f\x77\x6e","\x62\x6f\x75\x6e\x63\x65","\x62\x6f\x75\x6e\x63\x65\x49\x6e\x4c\x65\x66\x74","\x62\x6f\x75\x6e\x63\x65\x49\x6e\x52\x69\x67\x68\x74","\x62\x6f\x75\x6e\x63\x65\x49\x6e\x55\x70","\x62\x6f\x75\x6e\x63\x65\x49\x6e\x44\x6f\x77\x6e","\x65\x6c\x61\x73\x74\x69\x63\x49\x6e\x4c\x65\x66\x74","\x65\x6c\x61\x73\x74\x69\x63\x49\x6e\x52\x69\x67\x68\x74","\x65\x6c\x61\x73\x74\x69\x63\x49\x6e\x55\x70","\x65\x6c\x61\x73\x74\x69\x63\x49\x6e\x44\x6f\x77\x6e","\x7a\x6f\x6f\x6d\x49\x6e","\x7a\x6f\x6f\x6d\x49\x6e\x4c\x65\x66\x74","\x7a\x6f\x6f\x6d\x49\x6e\x52\x69\x67\x68\x74","\x7a\x6f\x6f\x6d\x49\x6e\x55\x70","\x7a\x6f\x6f\x6d\x49\x6e\x44\x6f\x77\x6e","\x6a\x65\x6c\x6c\x79\x49\x6e\x4c\x65\x66\x74","\x6a\x65\x6c\x6c\x79\x49\x6e\x52\x69\x67\x68\x74","\x6a\x65\x6c\x6c\x79\x49\x6e\x44\x6f\x77\x6e","\x6a\x65\x6c\x6c\x79\x49\x6e\x55\x70","\x66\x6c\x69\x70\x49\x6e\x4c\x65\x66\x74","\x66\x6c\x69\x70\x49\x6e\x52\x69\x67\x68\x74","\x66\x6c\x69\x70\x49\x6e\x55\x70","\x66\x6c\x69\x70\x49\x6e\x44\x6f\x77\x6e","\x66\x6c\x69\x70\x49\x6e\x56","\x66\x6c\x69\x70\x49\x6e\x48"];d=f[Math.floor(Math.random()*f.length)]};var e=b.find("\x69\x6d\x67");if(e.length>0x1){if(c>0x0){e.eq(0x0).attr("\x63\x6c\x61\x73\x73","\x61\x30").appendTo(b);e.eq(0x1).attr("\x63\x6c\x61\x73\x73","\x61\x30\x20"+d)}else{e.eq(e.length-0x1).attr("\x63\x6c\x61\x73\x73","\x61\x30\x20"+d).prependTo(b);e.eq(0x0).attr("\x63\x6c\x61\x73\x73","\x61\x30")}}}}};$(function(){$("\x2e\x68\x65\x2d\x77\x72\x61\x70").live({mouseenter:function(){var b=$(this).find("\x2e\x68\x65\x2d\x76\x69\x65\x77").addClass("\x68\x65\x2d\x76\x69\x65\x77\x2d\x73\x68\x6f\x77");$("\x5b\x64\x61\x74\x61\x2d\x61\x6e\x69\x6d\x61\x74\x65\x5d",b).each(function(){var c=$(this).data("\x61\x6e\x69\x6d\x61\x74\x65");$(this).addClass(c)});$(this).find("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d").addClass("\x68\x65\x2d\x76\x69\x65\x77\x2d\x73\x68\x6f\x77")},mouseleave:function(){var b=$(this).find("\x2e\x68\x65\x2d\x76\x69\x65\x77").removeClass("\x68\x65\x2d\x76\x69\x65\x77\x2d\x73\x68\x6f\x77");$("\x5b\x64\x61\x74\x61\x2d\x61\x6e\x69\x6d\x61\x74\x65\x5d",b).each(function(){var c=$(this).data("\x61\x6e\x69\x6d\x61\x74\x65");$(this).removeClass(c)});$(this).find("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d").removeClass("\x68\x65\x2d\x76\x69\x65\x77\x2d\x73\x68\x6f\x77")},mousewheel:function(b,c,d,e){if($(this).find("\x2e\x68\x65\x2d\x73\x6c\x69\x64\x65\x72\x73").length==0x1){var f=$(this).find("\x2e\x68\x65\x2d\x73\x6c\x69\x64\x65\x72\x73");var g=e>0x0?0x1:-0x1;a.fn.switchImg(f,g);b.preventDefault()}else if($(this).find("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d").length==0x1){var f=$(this).find("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d");a.fn.changeZoom(f,b,c,d,e);b.preventDefault()}}});$("\x2e\x68\x65\x2d\x7a\x6f\x6f\x6d").live({mousemove:function(b){a.fn.moveZoom($(this),b)}});$("\x2e\x68\x65\x2d\x70\x72\x65").live("\x63\x6c\x69\x63\x6b",function(){var b=$(this).parents("\x2e\x68\x65\x2d\x77\x72\x61\x70").find("\x2e\x68\x65\x2d\x73\x6c\x69\x64\x65\x72\x73");a.fn.switchImg(b,-0x1)});$("\x2e\x68\x65\x2d\x6e\x65\x78\x74").live("\x63\x6c\x69\x63\x6b",function(){var b=$(this).parents("\x2e\x68\x65\x2d\x77\x72\x61\x70").find("\x2e\x68\x65\x2d\x73\x6c\x69\x64\x65\x72\x73");a.fn.switchImg(b,0x1)})});(function(b){var c=['\x44\x4f\x4d\x4d\x6f\x75\x73\x65\x53\x63\x72\x6f\x6c\x6c','\x6d\x6f\x75\x73\x65\x77\x68\x65\x65\x6c'];if(b.event.fixHooks){for(var e=c.length;e;){b.event.fixHooks[c[--e]]=b.event.mouseHooks}};b.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var e=c.length;e;){this.addEventListener(c[--e],d,false)}}else{this.onmousewheel=d}},teardown:function(){if(this.removeEventListener){for(var e=c.length;e;){this.removeEventListener(c[--e],d,false)}}else{this.onmousewheel=null}}};b.fn.extend({mousewheel:function(e){return e?this.bind("\x6d\x6f\x75\x73\x65\x77\x68\x65\x65\x6c",e):this.trigger("\x6d\x6f\x75\x73\x65\x77\x68\x65\x65\x6c")},unmousewheel:function(e){return this.unbind("\x6d\x6f\x75\x73\x65\x77\x68\x65\x65\x6c",e)}});function d(e){var f=e||window.event,g=[].slice.call(arguments,0x1),h=0x0,i=true,j=0x0,k=0x0;e=b.event.fix(f);e.type="\x6d\x6f\x75\x73\x65\x77\x68\x65\x65\x6c";if(f.wheelDelta){h=f.wheelDelta/0x78};if(f.detail){h=-f.detail/0x3};k=h;if(f.axis!==undefined&&f.axis===f.HORIZONTAL_AXIS){k=0x0;j=-0x1*h};if(f.wheelDeltaY!==undefined){k=f.wheelDeltaY/0x78};if(f.wheelDeltaX!==undefined){j=-0x1*f.wheelDeltaX/0x78};g.unshift(e,h,j,k);return(b.event.dispatch||b.event.handle).apply(this,g)}})(jQuery);