Use ie ff For the DIV layer moving with the mouse

Source: Internet
Author: User

. Center_div2
{
Position: absolute;
Z-index: 1;
Text-align: center;
Display: none;
Background-color: # e0e7ef;
}

. Center_div_tips2

{

Position: relative;

Color: red;

}

 

<Div id = "detaildiv" class = "center_div2">
<SPAN class = "center_div_tips2"> updating data... </span>
</Div>

 

Function isie (){

VaR osobject = "";
If (navigator. useragent. indexof ("MSIE")> 0 ){
Return true;
}
}

Function mousemove (EV ){

/* The event mechanism of IE and FF is different */

Ev = EV | window. event;
VaR mousepos = mousecoords (EV );
VaR detaildiv = Document. getelementbyid ("detaildiv"); // The layer to be popped up
Detaildiv. style. Left = (mousepos. x + 10) + "PX ";
Detaildiv. style. Top = (mousepos. Y + 18) + "PX ";
}

Function mousecoords (EV ){
If (EV. pagex | eV. Pagey ){
Return {
X: eV. pagex,
Y: eV. Pagey
};

}

 

/* The boundary processing of IE and FF is different */

If (isie ()){
Return {X: eV. clientx + document.doc umentelement. scrollleft-document.doc umentelement. clientleft, Y: eV. clienty + document.doc umentelement. scrolltop-document.doc umentelement. clienttop}
}
Else {
Return {X: eV. clientx + document. Body. scrollleft-document. Body. clientleft, Y: eV. clienty + document. Body. scrolltop-document. Body. clienttop}
}
}

Document. onkeydown = keydown;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.