(function ($) {
$.fn.extend ({
Show:function (Div) {
var w = this.width (),
h = this.height (),
Xpos = W/2,
Ypos = H/2,
EventType = "",
Direct = "";
This.css ({
"Overflow": "Hidden",
"Position": "Relative"
});
Div.css ({
"Position": "Absolute",
"Top": This.width ()
});
This.on ("MouseEnter mouseleave", function (e) {
var oe = e | | Event
var x = Oe.offsetx;
var y = oe.offsety;
var angle = Math.atan ((x-xpos)/(Y-ypos)) * 180/MATH.PI;
if (angle > -45 && angle < $ && y > Ypos) {
Direct = "Down";
}
if (angle > -45 && angle < $ && y < ypos) {
Direct = "Up";
}
if (((Angle > -90 && Angle <-45) | | (Angle > && angle < 90)) && x > Xpos) {
Direct = "Right";
}
if (((Angle > -90 && Angle <-45) | | (Angle > && angle < 90)) && x < xpos) {
Direct = "Left";
}
Move (E.type, direct)
});
function Move (eventtype, direct) {
if (EventType = = "MouseEnter") {
Switch (direct) {
Case ' down ':
Div.css ({
"Left": "0px",
"Top": H
}). Stop (True, true). Animate ({
"Top": "0px"
}, "Fast");
Break
Case ' up ':
Div.css ({
"Left": "0px",
"Top":-H
}). Stop (True, true). Animate ({
"Top": "0px"
}, "Fast");
Break
Case ' right ':
Div.css ({
"Left": W,
"Top": "0px"
}). Stop (True, true). Animate ({
"Left": "0px"
}, "Fast");
Break
Case ' left ':
Div.css ({
"Left":-W,
"Top": "0px"
}). Stop (True, true). Animate ({
"Left": "0px"
}, "Fast");
Break
}
} else {
Switch (direct) {
Case ' down ':
Div.stop (True, True). Animate ({
"Top": H
}, "Fast");
Break
Case ' up ':
Div.stop (True, True). Animate ({
"Top":-H
}, "Fast");
Break
Case ' right ':
Div.stop (True, True). Animate ({
"Left": w
}, "Fast");
Break
Case ' left ':
Div.stop (True, True). Animate ({
"Left":-W
}, "Fast");
Break
}
}
}
}
});
}) (JQuery)
/*
* Instructions for use:
* $ (". a"). Show ($ (". B"))
* A is the presentation layer and B is the mask layer
* B in the interior of a
*/
$ (". Case li. List"). each (function (i) {
$ (this). Show ($ (". case. List-wrap. Wrap"). EQ (i));
});
jquery Get mouse Move direction 2