欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

讓div層隨鼠標(biāo)移動(dòng)的實(shí)現(xiàn)代碼 ie ff

 更新時(shí)間:2009年12月18日 01:59:13   作者:  
隨鼠標(biāo)移動(dòng)的div層使用ie ff ,大家可以注意下兼容性的問(wèn)題。
.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"><img src="http://img.jb51.net/imgby/loading.gif" alt="" />數(shù)據(jù)更新中...</span>
</div>
復(fù)制代碼 代碼如下:

function IsIE() {
var OsObject = "";
if (navigator.userAgent.indexOf("MSIE") > 0) {
return true;
}
}
function mouseMove(ev) {
/*ie 與ff的event 機(jī)制不同*/
ev = ev || window.event;
var mousePos = mouseCoords(ev);
var detailDiv = document.getElementById("detailDiv"); //將要彈出的層
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
};
}
/*ie 與 ff的邊界 處理不同*/
if (IsIE()) {
return { x: ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y: ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }
}
else {
return { x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, y: ev.clientY + document.body.scrollTop - document.body.clientTop }
}
}
document.onkeydown = keydown;

相關(guān)文章

最新評(píng)論