We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE获取对象为window.event.srcElement
window.event.srcElement
function getTarget(e){ if( e.target ){ // chrome/firefox.... return e.target; }else if( window.event.srcElement ){ // IE return window.event.srcElement; } }
IE:document.body.***
document.body.***
function getScrollP(){ return { top: document.documentElement.scrollTop || document.body.scrollTop, left: document.documentElement.scrollLeft || document.body.scrollLeft; } }
function getWindow(){ if( typeof window.innerWidth != 'undefined' ){ return { width: window.innerWidth, height: window.innerHeight } }else{ return { width: document.documentElement.clientWidth, height:document.documentElement.clientHeight } } }
function mousePosition(e){ if( e.pageX || e.pageY ){ return { x: e.pageX,y: e.pageY }; } return{ x: e.clientX + document.body.scrollLeft - document.body.clientLeft, y: e.clientY + document.body.scrollTop - document.body.clientTop }; } function mouseMove(e){ e = e || window.event; document.getElementById('xxx').value = mousePosition(e).x; document.getElementById('yyy').value = mousePosition(e).y; } document.onmousemove = mouseMove;
demo
The text was updated successfully, but these errors were encountered:
No branches or pull requests
跨浏览器获取目标对象
IE获取对象为
window.event.srcElement
跨浏览器获取滚动条位置
IE:
document.body.***
跨浏览器获取可是窗口大小
跨浏览器获取屏幕坐标
demo
The text was updated successfully, but these errors were encountered: