Skip to content

Commit 33cf46d

Browse files
committed
👌 Reduce iframe height on overflow
1 parent 0e89b82 commit 33cf46d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/sphinx_peek/assets/sphinx_peek.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ function setPreviewPosition(preview, anchor, config) {
160160
height = window.innerHeight;
161161
}
162162

163-
// is the whole height not visible below the anchor
164-
if (pos_screen_top + height > window.innerHeight) {
163+
// is the whole height (+ margin) not visible below the anchor
164+
if (pos_screen_top + height + 20 > window.innerHeight) {
165165
if (window.innerHeight - position_anchor.top > position_anchor.top) {
166-
// more space below the anchor, so just it overflow the screen
166+
// more space below the anchor, so just adjust height
167+
height = window.innerHeight - position_anchor.top - 20;
167168
} else {
168169
// more space above the anchor, so move it there
169170
pos_screen_top = position_anchor.top - height - 10;

0 commit comments

Comments
 (0)