MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 83: | Line 83: | ||
}); | }); | ||
} | } | ||
if (e.target.classList && e.target.classList.contains('mwe-popups')){ | if (e.target.classList && e.target.classList.contains('mwe-popups')) { | ||
requestAnimationFrame(function () { | requestAnimationFrame(function () { | ||
var bodyLeft = document.body.getBoundingClientRect().left; | |||
var left = parseInt(window.getComputedStyle(e.target).left); | |||
e.target.style.left = left - bodyLeft + 'px'; | |||
}); | }); | ||
} | } | ||
// if (e.target.classList && e.target.classList.contains('mwe-popups')){ | |||
// console.log('target', e.target); | |||
// requestAnimationFrame(function () { | |||
// document.querySelectorAll('.cog-box-inner a').forEach(function(link){ | |||
// link.addEventListener('mouseover', function(event) { | |||
// var parentBox = this.closest('.cog-box-inner a'); | |||
// if (parentBox) { | |||
// console.log('parentBox', parentBox); | |||
// var linkTop = parentBox.getBoundingClientRect().top + window.scrollY; | |||
// var bodyTop = document.body.getBoundingClientRect().top + window.scrollY; | |||
// var top = parseInt(window.getComputedStyle(e.target).top); | |||
// var bodyLeft = document.body.getBoundingClientRect().left; | |||
// console.log('bodyLeft', bodyLeft); | |||
// var left = parseInt(window.getComputedStyle(e.target).left); | |||
// console.log('left', left); | |||
// console.log('styleLeft', left - bodyLeft); | |||
// console.log('styleTop', linkTop - e.target.offsetHeight - 5); | |||
// e.target.style.left = bodyLeft + 'px'; | |||
// e.target.style.top = linkTop - e.target.offsetHeight - 5 + 'px'; | |||
// } | |||
// }); | |||
// }); | |||
// }); | |||
// } | |||
}, | }, | ||
false | false | ||