MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 90: Line 90:
        var parentBox = this.closest('.cog-box-inner a');
        var parentBox = this.closest('.cog-box-inner a');
        if (parentBox) {
        if (parentBox) {
        console.log(e);
var linkTop = parentBox.getBoundingClientRect().top + window.scrollY;
            var rect = parentBox.getBoundingClientRect();
               
            console.log('Element position: ', rect);
                var bodyTop = document.body.getBoundingClientRect().top + window.scrollY;
                var top = parseInt(window.getComputedStyle(e.target).top);
                var bodyLeft = document.body.getBoundingClientRect().left;
                var left = parseInt(window.getComputedStyle(e.target).left);
 
                e.target.style.left = left - bodyLeft + 'px';
                e.target.style.top = linkTop - e.target.offsetHeight - 5 + 'px';
            // var rect = parentBox.getBoundingClientRect();
            // console.log('Element position: ', rect);
        }
        }
    });
    });