mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 01:26:12 +02:00
fix: #13705, don't cover link if preview is opening up
This commit is contained in:
@@ -358,7 +358,6 @@ define('forum/topic', [
|
|||||||
const postContent = link.parents('[component="topic"]').find('[component="post/content"]').first();
|
const postContent = link.parents('[component="topic"]').find('[component="post/content"]').first();
|
||||||
const postRect = postContent.offset();
|
const postRect = postContent.offset();
|
||||||
const postWidth = postContent.width();
|
const postWidth = postContent.width();
|
||||||
const linkRect = link.offset();
|
|
||||||
const { top } = link.get(0).getBoundingClientRect();
|
const { top } = link.get(0).getBoundingClientRect();
|
||||||
const dropup = top > window.innerHeight / 2;
|
const dropup = top > window.innerHeight / 2;
|
||||||
tooltip.on('mouseenter', function () {
|
tooltip.on('mouseenter', function () {
|
||||||
@@ -366,11 +365,16 @@ define('forum/topic', [
|
|||||||
});
|
});
|
||||||
tooltip.one('mouseleave', destroyTooltip);
|
tooltip.one('mouseleave', destroyTooltip);
|
||||||
$(window).off('click', onClickOutside).one('click', onClickOutside);
|
$(window).off('click', onClickOutside).one('click', onClickOutside);
|
||||||
tooltip.css({
|
const css = {
|
||||||
top: dropup ? linkRect.top - tooltip.outerHeight() : linkRect.top + 30,
|
|
||||||
left: postRect.left,
|
left: postRect.left,
|
||||||
width: postWidth,
|
width: postWidth,
|
||||||
});
|
};
|
||||||
|
if (dropup) {
|
||||||
|
css.bottom = window.innerHeight - top - window.scrollY + 5;
|
||||||
|
} else {
|
||||||
|
css.top = top + window.scrollY + 30;
|
||||||
|
}
|
||||||
|
tooltip.css(css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user