$("#cursorPlay li").on("mouseenter mouseleave",function(event){
var evType = event.type;
var direction = getDir($(this), {
x: event.pageX,
y: event.pageY
});
// console.log("evtype:"+evType+",dir:"+direction);
moveTo($(this),direction, evType);
});
2、
direction = Math.round((((Math.atan2(y, x) * (180 / Math.PI)) + 180) / 90) + 3) % 4;
function getDir($el, coordinates){
var w = $el.width(),
h = $el.height(),
x = (coordinates.x - $el.offset().left - (w / 2)) * (w > h ? (h / w) : 1),
y = (coordinates.y - $el.offset().top - (h / 2)) * (h > w ? (w / h) : 1),
direction = Math.round((((Math.atan2(y, x) * (180 / Math.PI)) + 180) / 90) + 3) % 4;
return direction;
}
function moveTo($el, direction, type){
var $layer = $el.find("div");
var coord = {};
if(type === "mouseenter"){
switch(direction){
case 0 : $layer.css("top","-100%").css("left","0px");break;
case 1 : $layer.css("left","100%").css("top","0px");break;
case 2 : $layer.css("top","100%").css("left","0px");break;
case 3 : $layer.css("left","-100%").css("top","0px");break;
}
coord = {left:0,top:0}
}else{
switch(direction){
case 0 : coord = {left:0,top:'-100%'};break;
case 1 : coord = {left:'100%',top:0};break;
case 2 : coord = {left:0,top:'100%'};break;
case 3 : coord = {left:'-100%',top:0};break;
}
}
$layer.animate(coord,300);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有