MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 63: Line 63:
/* 각주 팝업창 위치 보정 DOM */
/* 각주 팝업창 위치 보정 DOM */
document.body.addEventListener(
document.body.addEventListener(
     'mousemove',
     'DOMNodeInserted',
     function (e) {
     function (e) {
         if (e.target.classList && e.target.classList.contains('rt-tooltip')) {
         if (e.target.classList && e.target.classList.contains('rt-tooltip')) {
             requestAnimationFrame(function () {
             requestAnimationFrame(function () {
                 var bodyLeft = document.body.getBoundingClientRect().left;
                 var bodyLeft = document.body.getBoundingClientRect().left;
                    const tooltipElement = document.getElementById('tooltip');
                 var left = parseInt(window.getComputedStyle(e.target).left);
 
                 e.target.style.left = left - bodyLeft + 'px';
                 var left = Math.min(e.pageX, window.innerWidth - tooltipElement.offsetWidth);
 
                 e.target.style.left = left + 'px';
                e.target.style.top = e.pageY + 'px';
             });
             });
         }
         }