Copy codeThe Code is as follows :/*
* Copyright (c) 2010 Liu Jianhua
*
* The above copyright notice shall be
* Included in all copies or substantial portions of the Software.
* Example:
<Div style = "height: 1000px"> demo </div>
<Div id = "demo" style = "height: 50px; background: purple; width: 50px; z-index: 999999; position: absolute; left:-1000px; top: -1000px; "> demo </div>
<Script type = "text/javascript">
Var o = $ (document );
O. mousemove (function (e ){
Var d = document. getElementById ("demo ");
D. style. left = ($. mouse (e). left + 5) + "px ";
D. style. top = ($. mouse (e). top + 5) + "px ";
});
</Script>
*/
/*
* Mouse Plugin for jQuery
* Version: 1.0
* Release: 2010-03-30
*/
(Function ($ ){
// Main Method
JQuery. mouse = function (e ){
Var mouseleft = 0;
Var mousetop = 0;
If (! ($. Browser. msie &/MSIE \ s (5 \. 5 | 6 \.)/. test (navigator. userAgent )))
{
Mouseleft = e. pageX;
Mousetop = e. pageY;
}
Else
{
Var _ top = document. compatMode = "CSS1Compat "? Document.doc umentElement. scrollTop: document. body. scrollTop;
Var _ left = document. compatMode = "CSS1Compat "? Document.doc umentElement. scrollLeft: document. body. scrollLeft;
Mouseleft = _ left + event. clientX;
Mousetop = _ top + event. clientY;
}
Return {left: mouseleft, top: mousetop };
};
}) (JQuery );