Oycheungad (Talk | contribs) |
Oycheungad (Talk | contribs) |
||
Line 84: | Line 84: | ||
</style> | </style> | ||
<script> | <script> | ||
− | var | + | function readMouseMove(event){ |
− | + | var dot, eventDoc, doc, body, pageX, pageY; | |
− | + | ||
− | + | event = event || window.event; // IE-ism | |
− | + | ||
− | + | // If pageX/Y aren't available and clientX/Y are, | |
− | + | // calculate pageX/Y - logic taken from jQuery. | |
− | + | // (This is to support old IE) | |
− | + | if (event.pageX == null && event.clientX != null) { | |
− | + | eventDoc = (event.target && event.target.ownerDocument) || document; | |
− | + | doc = eventDoc.documentElement; | |
+ | body = eventDoc.body; | ||
+ | |||
+ | event.pageX = event.clientX + | ||
+ | (doc && doc.scrollLeft || body && body.scrollLeft || 0) - | ||
+ | (doc && doc.clientLeft || body && body.clientLeft || 0); | ||
+ | event.pageY = event.clientY + | ||
+ | (doc && doc.scrollTop || body && body.scrollTop || 0) - | ||
+ | (doc && doc.clientTop || body && body.clientTop || 0 ); | ||
+ | } | ||
+ | |||
+ | |||
var modal = document.getElementById('openModal'); | var modal = document.getElementById('openModal'); | ||
− | modal.style.left = | + | modal.style.left = event.pageX+'px'; |
− | modal.style.top = | + | modal.style.top = event.pageY+'px'; |
} | } | ||
document.onmousemove = readMouseMove; | document.onmousemove = readMouseMove; |
Revision as of 08:13, 30 August 2017
Name:
CoorX: CoorY:
our advisors