body{
width: 100%;
height: 100%;
overflow:hidden;
}
.index_img{
width: 100%;
height: 700px;
background: url('images/menu-bg-home.png') no-repeat;
background-size: 100% 100%;
float: left;
position: relative;
}
11111111111111111
$(function(){
var positionX = 0;
var positionY = 0;
$('#over_yzm').mousemove(function(e) {
var x = e.clientX, y = e.clientY;
if(positionX === 0 && positionY === 0){
positionX = x;
positionY = y;
}
if(x > positionX && y < positionY){
$('.index_img').stop().animate({'left':2,'top':2},'800',"easeOutCubic");
positionX = x;
positionY = y;
}else if(x > positionX && y > positionY){
$('.index_img').stop().animate({'left':-2,'top':1},'800',"easeOutCubic");
positionX = x;
positionY = y;
}else if(x < positionX && y < positionY){
$('.index_img').stop().animate({'left':2,'top':1},'800',"easeOutCubic");
positionX = x;
positionY = y;
}else if(x < positionX && y > positionY){
$('.index_img').stop().animate({'left':-2,'top':1},'800',"easeOutCubic");
positionX = x;
positionY = y;
}
})
$.extend($.easing,{
easeOutBack:function(x,t,b,c,d,s){
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c * ((t = t / d - 1) * t * t + 1) + b;
}
});
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史