MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 69: | Line 69: | ||
requestAnimationFrame(function () { | requestAnimationFrame(function () { | ||
var linkId = e.target.id.substring(3); | var linkId = e.target.id.substring(3); | ||
var $link = document.querySelector('#'+linkId); | var $link = document.querySelector('#'+linkId); | ||
var linkTop = $link.getBoundingClientRect().top + window.scrollY; | var linkTop = $link.getBoundingClientRect().top + window.scrollY; | ||
| Line 79: | Line 78: | ||
var left = parseInt(window.getComputedStyle(e.target).left); | var left = parseInt(window.getComputedStyle(e.target).left); | ||
e.target.style.left = left - bodyLeft + 'px'; | e.target.style.left = left - bodyLeft + 'px'; | ||
e.target.style.top = linkTop - bodyTop - e.target.offsetHeight - 5 + 'px'; | e.target.style.top = linkTop - bodyTop - e.target.offsetHeight - 5 + 'px'; | ||
}); | }); | ||
} | } | ||