|
19 | 19 | .bubble-box{ |
20 | 20 | max-width: 20rem; /* You are likely to change it */ |
21 | 21 | position: absolute; |
| 22 | + right: -999px; |
22 | 23 | background: white; |
23 | 24 | border-radius: 4px; |
24 | 25 | padding: 4px; |
25 | 26 | word-break: break-all; |
26 | 27 | word-wrap: break-word; |
27 | 28 | box-shadow: 5px 5px 5px 3px rgba(0,0,0,0.2); |
28 | | - transform: translate(-50%, -4px); |
| 29 | + transform: translate(-50%, calc(-100% - 4px)); |
29 | 30 | } |
30 | 31 | .bubble-box::after{ |
31 | 32 | content: ''; |
|
116 | 117 | if (bodyStyle.position === "static") { |
117 | 118 | Object.assign(divInf.style, { |
118 | 119 | left: `${(convertedP1.x + convertedP2.x) / 2}px`, |
119 | | - bottom: `${document.documentElement.clientHeight - convertedP1.y}px`, |
| 120 | + top: `${convertedP1.y}px`, |
120 | 121 | }); |
121 | 122 | } else { // if you set body `position` as `relative`, `absolute`, things can get complicated |
122 | 123 | const bodyRect = document.body.getBoundingClientRect(); |
123 | 124 | const bodyBorderLeft = parseFloat(bodyStyle.borderLeftWidth); |
124 | | - const bodyBorderBottom = parseFloat(bodyStyle.borderBottomWidth); |
| 125 | + const bodyBorderTop = parseFloat(bodyStyle.borderTopWidth); |
125 | 126 | Object.assign(divInf.style, { |
126 | | - left: `${(convertedP1.x + convertedP2.x) / 2 - bodyRect.left - bodyBorderLeft}px`, |
127 | | - bottom: `${bodyRect.bottom - convertedP1.y - bodyBorderBottom}px`, |
| 127 | + left: `${(convertedP1.x + convertedP2.x) / 2 - (bodyRect.left + document.documentElement.scrollLeft) - bodyBorderLeft}px`, |
| 128 | + top: `${convertedP1.y - (bodyRect.top + document.documentElement.scrollTop) - bodyBorderTop}px`, |
128 | 129 | }); |
129 | 130 | } |
130 | 131 | divInf.innerText = result.barcodeText; |
|
0 commit comments